Andrew Trick [Wed, 7 Mar 2012 00:44:24 +0000 (00:44 +0000)]
More git-svn compatible version string, by request.
If you're using git-svn, the clang and llvm repository will typically
map to a different revision.
Before we had:
clang version 3.1 (trunk 152167 trunk 152162)
After this change:
clang version 3.1 (trunk 152167) (llvm/trunk 152162)
So it's self-descriptive with an extra parens group. Which is more
compatible with version string parsers is probably debatable, but this
style was requested.
Michael Han [Wed, 7 Mar 2012 00:12:16 +0000 (00:12 +0000)]
Refactor Clang sema attribute handling.
This submission improves Clang sema handling by using Clang tablegen
to generate common boilerplate code. As a start, it implements AttributeList
enumerator generation and case statements for AttributeList::getKind.
A new field "SemaHandler" is introduced in Attr.td and by default set to 1
as most of attributes in Attr.td have semantic checking in Sema. For a small
number of attributes that don't appear in Sema, the value is set to 0.
Also there are a small number of attributes that only appear in Sema but not
in Attr.td. Currently these attributes are still hardcoded in Sema AttributeList.
The declarations of the operators no longer matched.
The definitions in ASTContext.h had 'throw()' removed,
but it was still present in Attr.h.
Somehow the buildbots missed this. clang merely warns about
a missing 'throw()' specification and suggested a Fix-It adding
it back, but gcc 4.5 is not so forgiving and gives an error.
Sean Callanan [Tue, 6 Mar 2012 21:34:12 +0000 (21:34 +0000)]
Extended the UnknownAnyTy resolver to handle
blocks with unknown return types. This allows
LLDB to call blocks even when their return types
aren't provided in the debug information.
Ted Kremenek [Tue, 6 Mar 2012 20:06:33 +0000 (20:06 +0000)]
Add new code migrator support for migrating existing Objective-C code to use
the new Objective-C NSArray/NSDictionary/NSNumber literal syntax.
This introduces a new library, libEdit, which provides a new way to support
migration of code that improves on the original ARC migrator. We now believe
that most of its functionality can be refactored into the existing libraries,
and thus this new library may shortly disappear.
Ted Kremenek [Tue, 6 Mar 2012 20:05:56 +0000 (20:05 +0000)]
Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,
NSNumber, and boolean literals. This includes both Sema and Codegen support.
Included is also support for new Objective-C container subscripting.
My apologies for the large patch. It was very difficult to break apart.
The patch introduces changes to the driver as well to cause clang to link
in additional runtime support when needed to support the new language features.
Docs are forthcoming to document the implementation and behavior of these features.
Daniel Dunbar [Tue, 6 Mar 2012 18:20:20 +0000 (18:20 +0000)]
AST: Move several Type::is...Type() functions to be inline.
- These functions are both (a) very commonly called and (b) excellent
candidates for CSE in the callers in which they are commonly used.
- That isHalfType() is hot makes me sad, but it is trivially when inlined (and
a huge waste of time when not!!!).
- The extra IsEnumDeclComplete() function is a hack to break the cycle between
Type.h and Decl.h, I'm not sure of how to do this more cleanly, but am open
to ideas.
Richard Smith [Tue, 6 Mar 2012 03:21:47 +0000 (03:21 +0000)]
User-defined literals: reject string and character UDLs in all places where the
grammar requires a string-literal and not a user-defined-string-literal. The
two constructs are still represented by the same TokenKind, in order to prevent
a combinatorial explosion of different kinds of token. A flag on Token tracks
whether a ud-suffix is present, in order to prevent clients from needing to look
at the token's spelling.
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