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.
Richard Smith [Fri, 9 Dec 2011 02:04:48 +0000 (02:04 +0000)]
Replace the implementation of __builtin_constant_p (which was based on the GCC
documentation) with one based on what GCC's __builtin_constant_p is actually
intended to do (discovered by asking a friendly GCC developer).
In particular, an expression which folds to a pointer is now only considered to
be a "constant" by this builtin if it refers to the first character in a string
literal.
This fixes a rather subtle wrong-code issue when building with glibc. Given:
Douglas Gregor [Fri, 9 Dec 2011 02:04:43 +0000 (02:04 +0000)]
Implement the notion of umbrella directories, which implicity cover
all of the headers below that particular directory. Use umbrella
directories as a clean way to deal with (1) directories/frameworks
that don't have an umbrella header, but don't want to enumerate all of
their headers, and (2) PrivateHeaders, which we never want to
enumerate and want to keep separate from the main umbrella header.
This also eliminates a little more of the "magic" for private headers,
and frameworks in general.
Move ChainedIncludesSource into the Frontend library. This never really
belonged in the Serialization library, it's setting up a compilation,
not just deserializing.
This should fix PR11512, making Serialization actually be layered below
Frontend, a long standing layering violation in Clang.
Clean up the comments for this file now that its contents are totally
different from what the comments indicated. Also drop a no longer used
include that also violates the layering between Serialization and
Frontend.
Move a free function from the Frontend library into the Lex library as
part of HeaderSearch. This function just normalizes filenames for use
inside of a synthetic include directive, but it is used in both the
Frontend and Serialization libraries so it needs a common home.
Separate the serialization library's diagnostics from the frontend's
diagnostics. Conflating them was highly confusing and makes it harder to
establish a firm layering separation between these two libraries.
Eli Friedman [Thu, 8 Dec 2011 23:54:21 +0000 (23:54 +0000)]
Misc Minix-specific changes to clang:
. move compiler-rt to a separate directory so the -L argument only includes compiler-rt (thanks joerg)
. build all clang subdirs
. switches the Minix platform to ELF
. normalizes toolchain invocation