Richard Smith [Mon, 5 Mar 2012 23:20:05 +0000 (23:20 +0000)]
static_assert: Allow any string-literal as the message, not just a character
string literal, and adjust the diagnostic code to match. This also causes us
to escape any control characters in the message.
Ted Kremenek [Mon, 5 Mar 2012 23:06:19 +0000 (23:06 +0000)]
Teach SimpleSValBuilder that (in the absence of more information) stack memory doesn't alias symbolic memory. This is a heuristic/hack, but works well in practice. Fixes <rdar://problem/10978247>.
Daniel Dunbar [Mon, 5 Mar 2012 21:02:05 +0000 (21:02 +0000)]
ASTContext: Don't use nothrow specifications on the new operators for allocating
from the ASTContext.
- Doing so requires the compiler to generate null checks against the returned
result, but the BumpPtrAllocator never returns null pointers.
- The optimizer can usually eliminate such checks, but not always, so this
gives us tighter codegen in some places.
- It would be really nice if we could just use __builtin_unreachable or
something to tell the optimizer that the allocator never returns null, but
LLVM isn't currently that smart.
Properly handle non-canonical underlying types in
ASTContext::getUnaryTransformType. This can happen if, for example,
an enumeration's underlying type is a typedef.
Fix a small difference in sema and codegen views of what needs to be output.
In the included testcase, soma thinks that we already have a definition after we
see the out of line decl. Codegen puts it in a deferred list, to be output if
a use is seen. This would break when we saw an explicit template instantiation
definition, since codegen would not be notified.
This patch adds a method to the consumer interface so that soma can notify
codegen that this decl is now required.
[preprocessor] Enhance PreprocessingRecord to keep track of locations of conditional directives.
Introduce PreprocessingRecord::rangeIntersectsConditionalDirective() which returns
true if a given range intersects with a conditional directive block.
[preprocessor] Enhance the preprocessor callbacks:
-Add location parameter for the directives callbacks
-Skip callbacks if the directive is inside a skipped range.
-Make sure the directive callbacks are invoked in source order.
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>.