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
Douglas Gregor [Thu, 8 Dec 2011 19:11:24 +0000 (19:11 +0000)]
Implement umbrella directories for modules, which are similar to
umbrella headers in the sense that all of the headers within that
directory (and eventually its subdirectories) are considered to be
part of the module with that umbrella directory. However, unlike
umbrella headers, which are expected to include all of the headers
within their subdirectories, Clang will automatically include all of
the headers it finds in the named subdirectory.
The intent here is to allow a module map to trivially turn a
subdirectory into a module, where the module's structure can mimic the
directory structure.
Douglas Gregor [Thu, 8 Dec 2011 17:39:04 +0000 (17:39 +0000)]
Within the module representation, generalize the notion of an umbrella
header to also support umbrella directories. The umbrella directory
for an umbrella header is the directory in which the umbrella header
resides.
Douglas Gregor [Thu, 8 Dec 2011 17:01:29 +0000 (17:01 +0000)]
Keep track of import dependencies between submodules within the module
that's currently being built. This is important for supporting
transitive dependencies ("export *" in the module map) completely.
Add an experimental MallocSizeofChecker, which reports inconsistencies
between the casted type of the return value of a malloc/calloc/realloc
call and the operand of any sizeof expressions contained within
its argument(s).
Hans Wennborg [Wed, 7 Dec 2011 10:33:11 +0000 (10:33 +0000)]
Make printf warnings refer to intmax_t et al. by name
in addition to underlying type.
For example, the warning for printf("%zu", 42.0);
changes from "conversion specifies type 'unsigned long'" to "conversion
specifies type 'size_t' (aka 'unsigned long')"
(This is a second attempt after r145697, which got reverted.)
Make changes to SDiagsWriter to make it work in combination with the ARC migrator:
-Allow it to be used with multiple BeginSourceFile/EndSourceFile calls; for this introduce
a "finish" callback method in the DiagnosticConsumer. SDiagsWriter finishes up the serialization
file inside this method.
-Make it independent of any particular DiagnosticsEngine; make it use the SourceManager of the
Diagnostic object.
-Ignore null source ranges.
Douglas Gregor [Wed, 7 Dec 2011 02:23:45 +0000 (02:23 +0000)]
Implement basic support for private headers in frameworks. In essence,
when we load a module map (module.map) from a directory, also load a
private module map (module_private.map) for that directory, if
present. That private module map can inject a new submodule that
captures private headers.
Richard Smith [Wed, 7 Dec 2011 00:43:50 +0000 (00:43 +0000)]
When folding the size of a global scope VLA to a constant, require the array
bound to not have side effects(!). Add constant-folding support for expressions
of void type, to ensure that we can still fold ((void)0, 1) as an array bound.
Richard Smith [Tue, 6 Dec 2011 23:25:15 +0000 (23:25 +0000)]
DeadStoresChecker: when whitelisting dead initializations with constants, look
for a foldable constant rather than an IR-level constant. This is still far too
liberal, but is a step in the right direction.
Anna Zaks [Tue, 6 Dec 2011 23:12:27 +0000 (23:12 +0000)]
[analyzer] Propagate taint through NonLoc to NonLoc casts.
- Created a new SymExpr type - SymbolCast.
- SymbolCast is created when we don't know how to simplify a NonLoc to
NonLoc casts.
- A bit of code refactoring: introduced dispatchCast to have better
code reuse, remove a goto.
- Updated the test case to showcase the new taint flow.