Douglas Gregor [Thu, 15 Dec 2011 00:53:32 +0000 (00:53 +0000)]
In debugger support mode, if we have a top-level message send
expression with an unknown result type, assume that the result type is
'id'. Fixes <rdar://problem/10400663>.
Richard Trieu [Thu, 15 Dec 2011 00:38:15 +0000 (00:38 +0000)]
Modify how the -verify flag works. Currently, the verification string and
diagnostic message are compared. If either is a substring of the other, then
no error is given. This gives rise to an unexpected case:
// expect-error{{candidate function has different number of parameters}}
will match the following error messages from Clang:
candidate function has different number of parameters (expected 1 but has 2)
candidate function has different number of parameters
It will also match these other error messages:
candidate function
function has different number of parameters
number of parameters
This patch will change so that the verification string must be a substring of
the diagnostic message before accepting. Also, all the failing tests from this
change have been corrected. Some stats from this cleanup:
87 - removed extra spaces around verification strings
70 - wording updates to diagnostics
40 - extra leading or trailing characters (typos, unmatched parens or quotes)
35 - diagnostic level was included (error:, warning:, or note:)
18 - flag name put in the warning (-Wprotocol)
Douglas Gregor [Thu, 15 Dec 2011 00:29:59 +0000 (00:29 +0000)]
Replace all comparisons between ObjCInterfaceDecl pointers with calls
to declaresSameEntity(), as a baby step toward tracking forward
declarations of Objective-C classes precisely. Part of
<rdar://problem/10583531>.
Richard Smith [Wed, 14 Dec 2011 21:55:23 +0000 (21:55 +0000)]
Halve the constexpr recursion depth in this test in an attempt to make the
freebsd bots happy. In the longer term, we should have a mechanism for moving
constexpr recursion off the call stack, to support the default limit of 512
suggested by the standard.
Anna Zaks [Wed, 14 Dec 2011 18:34:17 +0000 (18:34 +0000)]
[analyzer] Re-enable the test which was failing on one of the bots.
I cannot reproduce the failures neither on my machine nor on the same buildbot machine (with the clang binary built on it). Let's see if it fails again..
Douglas Gregor [Wed, 14 Dec 2011 16:03:29 +0000 (16:03 +0000)]
When name lookup comes across a declaration that is in a module that
is not visible, look for any previous declarations of that entity that
might be visible.
Anna Zaks [Wed, 14 Dec 2011 00:56:18 +0000 (00:56 +0000)]
[analyzer] Treat stdin as a source of taint.
Some of the test cases do not currently work because the analyzer core
does not seem to call checkers for pre/post DeclRefExpr visits.
(Opened radar://10573500. To be fixed later on.)
Richard Trieu [Tue, 13 Dec 2011 23:19:45 +0000 (23:19 +0000)]
Make the diagnostic message more consistant. Update the type comparison to
handle non-pointer types. This is for the extra info printed when function
types are compared.
Ted Kremenek [Tue, 13 Dec 2011 14:50:33 +0000 (14:50 +0000)]
Tweak ARC diagnostic categories and rename 'Automatic Reference Counting Issue' to 'ARC Parse Issue' and 'ARC Issue' to 'ARC Semantic Issue'. Patch by Jean-Daniel Dupas.
Eli Friedman [Mon, 12 Dec 2011 23:13:20 +0000 (23:13 +0000)]
Make CGRecordLayoutBuilder correctly switch over to a packed class when a class has a base whose alignment will break the class layout. <rdar://problem/10551376>.
Suppress -Warray-bounds in certain cases involving macros from system headers.
The motivation here is a "clever" implementation of strncmp(), which peels the first few comparisons via chained conditional expressions which ensure that the input arrays are known at compile time to be sufficiently large.
Chandler Carruth [Mon, 12 Dec 2011 04:28:35 +0000 (04:28 +0000)]
Update Clang to emit the new form of llvm.cttz and llvm.ctlz intrinsics,
setting the is_zero_undef flag appropriately to true as that matches the
semantics of these GCC builtins.
Anna Zaks [Sun, 11 Dec 2011 18:43:40 +0000 (18:43 +0000)]
[analyzer] CStringChecker should not rely on the analyzer generating UndefOrUnknown value when it cannot reason about the expression.
We are now often generating expressions even if the solver is not known to be able to simplify it. This is another cleanup of the existing code, where the rest of the analyzer and checkers should not base their logic on knowing ahead of the time what the solver can reason about.
In this case, CStringChecker is performing a check for overflow of 'left+right' operation. The overflow can be checked with either 'maxVal-left' or 'maxVal-right'. Previously, the decision was based on whether the expresion evaluated to undef or not. With this patch, we check if one of the arguments is a constant, in which case we know that 'maxVal-const' is easily simplified. (Another option is to use canReasonAbout() method of the solver here, however, it's currently is protected.)
This patch also contains 2 small bug fixes:
- swap the order of operators inside SValBuilder::makeGenericVal.
- handle a case when AddeVal is unknown in GenericTaintChecker::getPointedToSymbol.
Anna Zaks [Sat, 10 Dec 2011 23:36:51 +0000 (23:36 +0000)]
[analyzer] Introduce IntSymExpr, where the integer is on the lhs.
Fix a bug in SimpleSValBuilder, where we should swap lhs and rhs when calling generateUnknownVal(), - the function which creates symbolic expressions when data is tainted. The issue is not visible when we only create the expressions for taint since all expressions are commutative from taint perspective.
Refactor SymExpr::symbol_iterator::expand() to use a switch instead of a chain of ifs.
Richard Smith [Sat, 10 Dec 2011 01:10:13 +0000 (01:10 +0000)]
Add a fast path to the constant evaluator for integer literals. This speeds up
compilation of some translation units of SPEC's 445.gobmk by ~4%, and does not
seem to cause a measurable slowdown in other cases.
Douglas Gregor [Sat, 10 Dec 2011 00:23:21 +0000 (00:23 +0000)]
When we manage to re-use an expression during tree transformation (=
template instantiation), and that expression might produce a
temporary, invoke MaybeBindToTemporary. Otherwise, we forget to
destroy objects, release objects, etc. Fixes <rdar://problem/10531073>.
Daniel Dunbar [Fri, 9 Dec 2011 23:41:18 +0000 (23:41 +0000)]
Driver: Handle -f{no-}honor-infinities, -f{no-}honor-nans, and
-ffinite-math-only.
- No test case yet, I don't know how to construct a situation where this
matters.
Richard Smith [Fri, 9 Dec 2011 22:58:01 +0000 (22:58 +0000)]
C++11 constant expressions: Don't use CheckICE in C++11; instead, determine
whether an expression is a (core) constant expression as a side-effect of
evaluation. This takes us from accepting far too few expressions as ICEs to
accepting slightly too many -- fixes for the remaining cases are coming next.
The diagnostics produced when an expression is found to be non-constant are
currently quite poor (with generic wording but reasonable source locations),
and will be improved in subsequent commits.
David Blaikie [Fri, 9 Dec 2011 18:32:50 +0000 (18:32 +0000)]
Provide a separate warning for weak vtables in explicit template instantiations. There's no (current) way to fix such templates to emit strong symbols/vtables, but perhaps users want to know about the cost being incurred anyway.
Douglas Gregor [Fri, 9 Dec 2011 16:48:01 +0000 (16:48 +0000)]
When performing subframework header lookup, don't search for
".framework/" in the path name, because it could be ".framework\" on
Windows. This whole function needs to be rewritten with PathV2.
Richard Smith [Fri, 9 Dec 2011 06:47:34 +0000 (06:47 +0000)]
Teach isConstantInitializer that numeric literals are constants, rather than
having it evaluate them. No change in functionality, but a speed up of about 5%
on some translation units in SPEC 445.gobmk.