Richard Smith [Mon, 5 Mar 2012 04:02:15 +0000 (04:02 +0000)]
Lexing support for user-defined literals. Currently these lex as the same token
kinds as the underlying string literals, and we silently drop the ud-suffix;
those issues will be fixed by subsequent patches.
Chris Lattner [Sun, 4 Mar 2012 00:56:24 +0000 (00:56 +0000)]
From his comment in PR12168, Eli seems confused about the alignment assumptions
we're making. We only ignore implicit casts. Add a testcase showing that
we get the right behavior with explicit casts.
Eli Friedman [Sat, 3 Mar 2012 04:09:56 +0000 (04:09 +0000)]
Avoid an unnecessary recursive loop between type canonicalization and NNS canonicalization which would (rarely) lead to memory corruption. While I'm here, simplify. Fixes PR12166. Not committing a testcase because it's impossible to reduce it.
Daniel Dunbar [Sat, 3 Mar 2012 00:36:06 +0000 (00:36 +0000)]
Frontend: Default to creating output files using temporary files + rename.
- This is a more reliable default, as it behaves better on failure and also
ensures that we create *new* files (instead of reusing existing inodes). This
is useful for other applications (like lldb) which want to cache inode's to
know when a file has been rewritten.
Daniel Dunbar [Sat, 3 Mar 2012 00:36:02 +0000 (00:36 +0000)]
Frontend: Don't automatically create missing directories when using temporary files with createOutputFile()
- This would otherwise happen as a side effect of llvm::sys::fs::unique_file creating parent directories.
Richard Smith [Fri, 2 Mar 2012 23:27:11 +0000 (23:27 +0000)]
Reinstate r151879, r151880, reverted in r151922, along with a bugfix for
scalar emission of DeclRefExprs to const bools: emit scalar bools as i1,
not as i8.
In addition to the extra unit testing, this has successfully bootstrapped.
Anna Zaks [Fri, 2 Mar 2012 22:54:36 +0000 (22:54 +0000)]
[analyzer] Rename clang::CallGraph into clang::idx::CallGraph + rename
the corresponding files to avoid confusion.
This is a preparation to adding an AST-based call graph to Analysis. The
existing call graph works with indexer entries. We might be able to
refactor it to use the AST based graph in the future.
(Minimal testing here as the only example that uses the API has been
completely broken, does not compile.)
objc: When issue diagnostic about deprecated method, also
issue the note if it is because message is sent to a forward class
declaration in delayed diagnostic. // rdar://10290322
Daniel Dunbar [Fri, 2 Mar 2012 16:24:25 +0000 (16:24 +0000)]
Revert r151879, r151880, "PR12145: Avoid emitting loads of constexpr variables in contexts where there" and "Fix buildbot: make this test less dependent on the value names in the produced IR."
David Chisnall [Fri, 2 Mar 2012 10:49:52 +0000 (10:49 +0000)]
Add the Solaris support directory to the header search when using libc++.
Unconditionally define __C99FEATURES__ when using C++ on Solaris. This is a
(hopefully temporary) work around for libc++ exposing C99-but-not-C++98
features in C++98 mode.
Richard Smith [Fri, 2 Mar 2012 04:14:40 +0000 (04:14 +0000)]
Ensure that we instantiate static reference data members of class templates
early, since their values can be used in constant expressions in C++11. For
odr-use checking, the opposite change is required, since references are
odr-used whether or not they satisfy the requirements for appearing in a
constant expression.
Richard Smith [Fri, 2 Mar 2012 03:16:32 +0000 (03:16 +0000)]
PR12145: Avoid emitting loads of constexpr variables in contexts where there
is no odr-use of the variable. Go slightly beyond what the standard requires
for variables of reference type.
Ted Kremenek [Fri, 2 Mar 2012 01:27:31 +0000 (01:27 +0000)]
[analyzer diagnostics] Change CompactPathDiagnostic to recursively compact diagnostics in calls into macro pieces.
Also fix handling of macros within calls in the HTMLDiagnostics.
c/objc: problem originally reported as an objective-c bug.
But it is in the underlying c part of clang. clang crashes
in IRGen when passing an incomplete type argument to
variadic function (instead of diagnosing the bug).
// rdar://10961370
Ted Kremenek [Thu, 1 Mar 2012 23:06:04 +0000 (23:06 +0000)]
Teach the analyzer to just ignore CXXBindTemporaryExpr. There's nothing special to do with it, since destructors are represented explicitly in the CFG.
Add a flag -fthread-sanitizer.
This flag enables ThreadSanitizer instrumentation committed to llvm as r150423.
The patch includes one test for -fthread-sanitizer and one similar test for -faddress-sanitizer.
This patch does not modify the linker flags (as we do it for -faddress-sanitizer) because the run-time library is not yet
committed and it's structure in compiler-rt is not 100% clear.
The users manual wil be changed in a separate commit.
Ted Kremenek [Thu, 1 Mar 2012 22:07:04 +0000 (22:07 +0000)]
Change @import to @__experimental_modules_import. We are not ready to commit to a particular syntax for modules,
and don't have time to push it forward in the near future.
Eli Friedman [Thu, 1 Mar 2012 04:01:32 +0000 (04:01 +0000)]
Implement "optimization" for lambda-to-block conversion which inlines the generated block literal for lambdas which are immediately converted to block pointer type. This simplifies the AST, avoids an unnecessary copy of the lambda and makes it much easier to avoid copying the result onto the heap.
Note that this transformation has a substantial semantic effect outside of ARC: it gives the converted lambda lifetime semantics similar to a block literal. With ARC, the effect is much less obvious because the lifetime of blocks is already managed.
Richard Smith [Thu, 1 Mar 2012 02:59:17 +0000 (02:59 +0000)]
Reject 'a = {0} = {0}' rather than parsing it as '(a = {0}) = {0}'. Also
improve the diagnostics for some attempts to use initializer lists in
expressions.
Ted Kremenek [Thu, 1 Mar 2012 01:40:32 +0000 (01:40 +0000)]
Fix regression from llvm-gcc where we should NOT emit a warning about __attribute__((NSObject)) on a property declaration. This is needed to have retain properties for non-object pointers. Fixes <rdar://problem/10930507>.
Nico Weber [Wed, 29 Feb 2012 22:54:43 +0000 (22:54 +0000)]
Allow operator keywords to be #defined in ms-ext mode.
Fixes PR10606.
I'm not sure if this is the best way to go about it, but
I locally enabled this code path without the msext conditional,
and all tests pass, except for test/Preprocessor/cxx_oper_keyword.cpp
which explicitly checks that operator keywords can't be redefined.
I also parsed chromium/win with a clang with and without this patch.
It introduced no new errors, but removes 43 existing errors.
objective-c: provide fixit hint when atomic property does not
have matching user defined setter/getter and a warning is issued.
In this case, a fixit note is displayed. // rdar://10267155
Chad Rosier [Wed, 29 Feb 2012 20:14:59 +0000 (20:14 +0000)]
Allocate TargetLibraryInfo for the CodeGen passes. Otherwise, it's instantiated
by the BAA pass, which uses the default TargetLibraryInfo constructor.
Unfortunately, the default TargetLibraryInfo constructor assumes all library
calls are available and thus ignores -fno-builtin.
rdar://10947759
Anna Zaks [Wed, 29 Feb 2012 18:42:47 +0000 (18:42 +0000)]
[analyzer] Malloc: A pointer might escape through CFContainers APIs,
funopen, setvbuf.
Teach the checker and the engine about these APIs to resolve malloc
false positives. As I am adding more of these APIs, it is clear that all
this should be factored out into a separate callback (for example,
region escapes). Malloc, KeyChainAPI and RetainRelease checkers could
all use it.
Daniel Dunbar [Wed, 29 Feb 2012 03:04:05 +0000 (03:04 +0000)]
Sema/ObjC: Override search can generate a large search list, bump the base size
of the SmallPtrSet way up to avoid commonly reallocating the buffer size.
- I didn't see a good argument against it, so I bumped the limit to cover the
max size we see during parsing Cocoa.h.
Daniel Dunbar [Wed, 29 Feb 2012 02:39:13 +0000 (02:39 +0000)]
ASTWriter: Cache some DenseMaps we use repeatedly.
- This reduces our total # of allocations building a PCH for Cocoa.h by almost
a whopping 50%.
- A SmallPtrMap would be cleaner, but since we don't have one yet...