Commit Graph

24306 Commits

Author SHA1 Message Date
Ted Kremenek d151dde0e6 Enable default @synthesize by default.
llvm-svn: 152140
2012-03-06 20:06:15 +00:00
Ted Kremenek 415287d943 Add static analyzer support for new NSArray/NSDictionary/NSNumber literals.
llvm-svn: 152139
2012-03-06 20:06:12 +00:00
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 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
Fariborz Jahanian d7a3261dfb objective-c modern translator. Don't ignore unnamed bitfields
when rewriting.

llvm-svn: 152123
2012-03-06 17:16:27 +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
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
Ted Kremenek 024ba20bef [analyzer] 'Looping back to the head of the loop' diagnostics are prunable.
llvm-svn: 152083
2012-03-06 01:00:36 +00:00
Jordy Rose 330de22fe0 [analyzer] Remove now-unused constant. No functionality change.
llvm-svn: 152080
2012-03-06 00:33:35 +00:00
Jordy Rose 0accc6ae7b [analyzer] Fix unnecessary dyn_cast_or_null. No functionality change.
llvm-svn: 152078
2012-03-06 00:28:20 +00:00
Ted Kremenek 6762a94040 Teak CallAndMessageChecker to only warn about uninitialized struct fields in call arguments
when the called function is never inlined.

Fixes <rdar://problem/10977037>.

llvm-svn: 152073
2012-03-05 23:57:14 +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
Ted Kremenek 9d96f843b8 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>.
llvm-svn: 152065
2012-03-05 23:06:19 +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
Anna Zaks 9bd4be9657 [analyzer] Time the execution (per each TU) with -analyzer-stats.
llvm-svn: 152059
2012-03-05 20:53:59 +00:00
Sebastian Redl 249dee5433 If the element type of an initializer list has a destructor, make sure we check it. Fixes PR12178.
llvm-svn: 152048
2012-03-05 19:35:43 +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
Anna Zaks 53a0b6c161 [analyzer] False positive in SelfInit - teach the checker about method
calls with self as a parameter.

llvm-svn: 152039
2012-03-05 18:58:25 +00:00
Anna Zaks 12a8b90a36 [analyzer] Malloc should assume that ownership is transfered when
calling an ObjC method ending with 'NoCopy'.

llvm-svn: 152037
2012-03-05 17:42:10 +00:00
Benjamin Kramer 73ecd70d38 Avoid double lookup.
llvm-svn: 152033
2012-03-05 17:20:04 +00:00
Peter Collingbourne 15d48ec46f Properly handle non-canonical underlying types in
ASTContext::getUnaryTransformType.  This can happen if, for example,
an enumeration's underlying type is a typedef.

llvm-svn: 152031
2012-03-05 16:02:06 +00:00
Nico Weber b3ec7308b0 Fix a -Wstring-plus-int warning.
Patch from Sean Silva <silvas@purdue.edu>!

llvm-svn: 152030
2012-03-05 15:48:34 +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
James Molloy 7583ccdc1f Fix a bug in the mangler where in 'namespace std { extern "C" {X;} }', X would not be seen to be in ::std::.
Migrate two other places where the same logic is used to use the helper function that already exists.

llvm-svn: 152022
2012-03-05 09:59:43 +00:00
Argyrios Kyrtzidis afdc66f4fa [arcmt]
-Make sure we don't change to '__weak' a __block variable used as output.
-Make sure we don't apply __weak twice.

Fixes rdar://10520757&10521362

llvm-svn: 152020
2012-03-05 08:46:24 +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
Chandler Carruth 52b6ac2a78 Silence a GCC warning about a set-but-not-used variable in release builds.
llvm-svn: 152005
2012-03-04 12:16:40 +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
Chris Lattner aaa18fad7d add a testcase for PR12094 and fix a crash on pointer to incomplete type,
reported by Richard Smith.

llvm-svn: 151993
2012-03-04 00:52:12 +00:00
Richard Smith 522fa53703 Add a pile of tests for unrestricted unions, and advertise support for them.
llvm-svn: 151992
2012-03-03 23:51:05 +00:00
Richard Smith 2e312c8738 constexpr: Remove APValue/CCValue distinction. It is no longer useful given the
resolution of core issue 1454.

llvm-svn: 151991
2012-03-03 22:46:17 +00:00
Benjamin Kramer 15ceed9a9e Remove unused variable.
llvm-svn: 151989
2012-03-03 21:52:22 +00:00
Eli Friedman 5358a0ab5a 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.
llvm-svn: 151967
2012-03-03 04:09:56 +00:00
Ted Kremenek 868dbda367 [analyzer] do not warn about returning stack-allocated memory when it comes from an ancestor stack frame.
llvm-svn: 151964
2012-03-03 01:22:03 +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
DeLesley Hutchins e2a3f75a12 Thread safety analysis: expand set of expressions that can be used to denote locks.
llvm-svn: 151956
2012-03-02 23:36:05 +00:00
Richard Smith bc638767f8 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.

llvm-svn: 151955
2012-03-02 23:27:11 +00:00
Anna Zaks b8b21e9b56 Unbreak the CMake builds following the CallGraph change.
llvm-svn: 151952
2012-03-02 23:18:45 +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