Commit Graph

12044 Commits

Author SHA1 Message Date
Ted Kremenek e65b086e07 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.

llvm-svn: 152137
2012-03-06 20:05:56 +00:00
Chad Rosier 94bdf697b2 Minor fix for r152130. Put -fno-inline in f_Group.
llvm-svn: 152132
2012-03-06 19:02:54 +00:00
Chad Rosier 806031896d [driver] Add support for -fno-inline.
rdar://10972766

llvm-svn: 152130
2012-03-06 18:49:20 +00:00
Fariborz Jahanian 197c68c856 Undo patch for // rdar://10735698
llvm-svn: 152128
2012-03-06 18:41:35 +00:00
Daniel Dunbar 492488271f 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.

llvm-svn: 152126
2012-03-06 18:20:20 +00:00
Benjamin Kramer d78f1ec183 NamespaceDecl: Call non-virtual method inside virtual method, not the other way round.
Moves the virtual call out of a hot path during lookup, no other functionality change.

llvm-svn: 152124
2012-03-06 18:07:25 +00:00
Argyrios Kyrtzidis 70b0878c46 Use newly introduced const-goodness of TinyPtrVector.
llvm-svn: 152108
2012-03-06 07:15:06 +00:00
Richard Smith d67aea28f6 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.

llvm-svn: 152098
2012-03-06 03:21:47 +00:00
Argyrios Kyrtzidis 735f9d4805 Use TinyPtrVector instead of UsuallyTinyPtrVector.
The latter is just a worse version of the former.

llvm-svn: 152096
2012-03-06 03:00:11 +00:00
Argyrios Kyrtzidis 04bd4321b9 Move clang/Basic/UsuallyTinyPtrVector.h to llvm/ADT/UsuallyTinyPtrVector.h.
Depends on llvm commit r152090.

llvm-svn: 152091
2012-03-06 02:09:28 +00:00
Ted Kremenek 04e860df2c [analyzer] add a diagnostic event when entering a call via inlining, within the callee, and add an edge.
llvm-svn: 152086
2012-03-06 01:25:01 +00:00
Argyrios Kyrtzidis 840497dd81 Move include/clang/AST/UsuallyTinyPtrVector.h -> include/clang/Basic/UsuallyTinyPtrVector.h
and add an erase method to it.

Patch by Andrew Craik!

llvm-svn: 152082
2012-03-06 00:49:28 +00:00
Argyrios Kyrtzidis b5e420f707 Add some doxygen comments.
llvm-svn: 152075
2012-03-06 00:16:36 +00:00
Anna Zaks a5b86343f5 [analyzer] Bump up the size of the functions that should be
considered for inlining to 200 BBs.

Setting the max to 10 BBs introduced several false negatives, we'll
reevaluate the setting later on along with other inlining heuristics.

llvm-svn: 152072
2012-03-05 23:54:55 +00:00
Fariborz Jahanian d3ba40b90f Minor refactoring for previous patch for // rdar://10735698
llvm-svn: 152071
2012-03-05 23:38:41 +00:00
Richard Smith f506eaf36d 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.

llvm-svn: 152069
2012-03-05 23:20:05 +00:00
Daniel Dunbar 6290557872 AST/stats: Don't effectively use an out-of-line function to return a static
bool. Ugh.

llvm-svn: 152062
2012-03-05 21:42:49 +00:00
Daniel Dunbar e5617c79e4 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.

llvm-svn: 152060
2012-03-05 21:02:05 +00:00
Fariborz Jahanian b0d7ce1b78 patch to optionally warn for block implementations without explicit
return types that return non-void values. // rdar://10735698

llvm-svn: 152047
2012-03-05 19:34:00 +00:00
Benjamin Kramer 27402c61c8 TargetInfo: create less temporary strings.
llvm-svn: 152029
2012-03-05 15:10:44 +00:00
Rafael Espindola 189fa748ec 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.

llvm-svn: 152024
2012-03-05 10:54:55 +00:00
Argyrios Kyrtzidis 647dcd80f0 [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.

llvm-svn: 152018
2012-03-05 05:48:17 +00:00
Argyrios Kyrtzidis c793a61355 [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.

llvm-svn: 152017
2012-03-05 05:48:09 +00:00
Richard Smith e18f0faff2 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.

llvm-svn: 152012
2012-03-05 04:02:15 +00:00
Erik Verbruggen 8c738bc98a Remove a recursive visitation in ExprEngine that is no longer needed because the CFG is fully linearized.
llvm-svn: 152007
2012-03-04 18:12:21 +00:00
Richard Smith 72eebee0cb Add tests for [over.literal]. Fix a few bugs which were exposed by the tests.
llvm-svn: 151997
2012-03-04 09:41:16 +00:00
Richard Smith 906ccc167c Factor bitfields of LangOptions out into a base class in order to make them
trivially-copyable. 50KiB reduction in clang binary size.

llvm-svn: 151963
2012-03-03 00:52:40 +00:00
Daniel Dunbar ae77b3dfad 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.

llvm-svn: 151961
2012-03-03 00:36:06 +00:00
Daniel Dunbar b9c62c0773 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.

llvm-svn: 151960
2012-03-03 00:36:02 +00:00
Anna Zaks fc5dfe9f7c [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.)

llvm-svn: 151950
2012-03-02 22:54:36 +00:00
Aaron Ballman 611306eae6 Adding support for #pragma include_alias in MS compatibility mode. This implements PR 10705.
llvm-svn: 151949
2012-03-02 22:51:54 +00:00
DeLesley Hutchins 71d6103295 Issue warning when late-parsed attributes have no declaration.
llvm-svn: 151947
2012-03-02 22:29:50 +00:00
DeLesley Hutchins bd2ee13e78 Make late-parsed attributes follow the conventions of ordinary
GNU attributes to a better extent, by allowing them in more
places on a declator.

llvm-svn: 151945
2012-03-02 22:12:59 +00:00
Nico Weber ccec40d9b7 Add -Wstring-plus-int, which warns on "str" + int and int + "str".
It doesn't warn if the integer is known at compile time and within
the bounds of the string.

Discussion: http://comments.gmane.org/gmane.comp.compilers.clang.scm/47203
llvm-svn: 151943
2012-03-02 22:01:22 +00:00
Fariborz Jahanian 7923ef41e1 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

llvm-svn: 151942
2012-03-02 21:50:02 +00:00
Nico Weber 99c07bc822 Move int<->pointer conversion warnings behind -Wint-conversions.
This is consistent with -Wbool-conversion. Let me know if you prefer
a different flag name.

llvm-svn: 151934
2012-03-02 20:23:08 +00:00
Anna Zaks 265087721a [analyzer] Bound the size of the functions being inlined + provide
command line options for inlining tuning.

This adds the option for stack depth bound as well as function size
bound. 

+ minor doxygenification

llvm-svn: 151930
2012-03-02 19:05:03 +00:00
Jia Liu 5c302484e9 clang -v support for separate clang.git and llvm.git, patch by Andrew Trick.
llvm-svn: 151910
2012-03-02 14:37:41 +00:00
Ted Kremenek 9466603322 Moving tagging of '__experimental_modules_import' IdentifierInfo out of
IndentifierTable::get() and into IdentifierTable's constructor.

This gets a 0.7% reducing on lexing time for Cocoa.h, and
about the same for PCH generation.

llvm-svn: 151854
2012-03-01 22:53:32 +00:00
Anna Zaks d5c3027473 [analyzer] Turn inlining on by default for better testing exposure.
Fix a test, which was most likely an unintended recursive call.

llvm-svn: 151848
2012-03-01 22:37:46 +00:00
Kostya Serebryany 28a7a1198b 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.

llvm-svn: 151846
2012-03-01 22:27:08 +00:00
Ted Kremenek c1e4dd0e8e 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.

llvm-svn: 151841
2012-03-01 22:07:04 +00:00
Richard Smith ead9a05596 Revert r151800, which was committed without review and has correctness issues.
llvm-svn: 151804
2012-03-01 06:49:39 +00:00
Aaron Ballman 4fd4e6d75b Fixing a buildbot complaint about nested templates.
llvm-svn: 151803
2012-03-01 04:55:54 +00:00
Aaron Ballman cd5092dfba Implements support for #pragma include_alias in ms compatibility mode. Fixes PR10705.
llvm-svn: 151800
2012-03-01 04:18:49 +00:00
Eli Friedman 98b01edc8c 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.

llvm-svn: 151797
2012-03-01 04:01:32 +00:00
Richard Smith 5e0cac784a 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.

llvm-svn: 151794
2012-03-01 02:59:17 +00:00
Eli Friedman 2fb8512888 Tighten type-checking a bit to make it clearer how BuildCXXMemberCallExpr is used.
llvm-svn: 151783
2012-03-01 01:30:04 +00:00
Nico Weber 2e686205e8 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.

llvm-svn: 151768
2012-02-29 22:54:43 +00:00
Fariborz Jahanian 86c2f5cc70 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

llvm-svn: 151766
2012-02-29 22:18:55 +00:00