Commit Graph

2064 Commits

Author SHA1 Message Date
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 77006f6875 And libclang cursor/indexing support for new Objective-C NSArray/NSDictionary/NSNumber literals.
llvm-svn: 152138
2012-03-06 20:06:06 +00:00
Jim Grosbach 6c258a891f Add MCRegisterInfo to the MCInstPrinter factory function interface.
llvm-svn: 152046
2012-03-05 19:33:41 +00:00
Argyrios Kyrtzidis 981a961d03 Move llvm/ADT/SaveAndRestore.h -> llvm/Support/SaveAndRestore.h.
Needs llvm update.

llvm-svn: 151829
2012-03-01 19:45:56 +00:00
Daniel Dunbar 0b4b32433c Remove stray semi-colon.
llvm-svn: 151682
2012-02-29 00:20:42 +00:00
Argyrios Kyrtzidis 3460880674 [AST] When we @synthesize a property with a user-defined ivar name,
make sure to record the source location of the ivar name.
[libclang] When indexing @synthesized objc methods, report the @implementation
as the lexical container.

Fixes rdar://10905472

llvm-svn: 151635
2012-02-28 17:50:39 +00:00
Argyrios Kyrtzidis 93db2923da [libclang] When indexing an objc property, also provide information about
the getter/setter objc method entities that the property is associated with.

rdar://10244558

llvm-svn: 151634
2012-02-28 17:50:33 +00:00
Argyrios Kyrtzidis ceeb19cf18 [AST] Associate the getter/setter methods to a property of a objc class extension.
[libclang] Index the getter/setter methods of a property of a objc class extension.

Fixes rdar://10907597

llvm-svn: 151633
2012-02-28 17:50:28 +00:00
Argyrios Kyrtzidis bb5abc7b49 Move "clang/Analysis/Support/SaveAndRestore.h" to "llvm/ADT/SaveAndRestore.h"
to make it more widely available.

Depends on llvm commit r151564

llvm-svn: 151566
2012-02-27 21:09:45 +00:00
Argyrios Kyrtzidis 335c5a42e9 Don't record nested macro expansions in the preprocessing record,
it can only bring pain when dealing with preprocessor abuse (see: boost).

rdar://10898986

llvm-svn: 151427
2012-02-25 02:41:16 +00:00
Douglas Gregor 29c42f2a25 Implement a new type trait __is_trivially_constructible(T, Args...)
that provides the behavior of the C++11 library trait
std::is_trivially_constructible<T, Args...>, which can't be
implemented purely as a library.

Since __is_trivially_constructible can have zero or more arguments, I
needed to add Yet Another Type Trait Expression Class, this one
handling arbitrary arguments. The next step will be to migrate
UnaryTypeTrait and BinaryTypeTrait over to this new, more general
TypeTrait class.

Fixes the Clang side of <rdar://problem/10895483> / PR12038.

llvm-svn: 151352
2012-02-24 07:38:34 +00:00
Ted Kremenek d87cdd1d11 Update set-xcode-analyzer to work with Xcode repackaging in Xcode 4.3
llvm-svn: 151179
2012-02-22 18:44:35 +00:00
Argyrios Kyrtzidis a1bed4cd96 [libclang] Index the field references of a designated initializer, rdar://10906206
llvm-svn: 151118
2012-02-22 02:10:41 +00:00
Dylan Noblesmith c95d81924d Basic: import IntrusiveRefCntPtr<> into clang namespace
The class name is long enough without the llvm:: added.
Also bring in RefCountedBase and RefCountedBaseVPTR.

llvm-svn: 150958
2012-02-20 14:00:23 +00:00
Sebastian Redl 6047f07e81 Revert "Revert "Make CXXNewExpr contain only a single initialier, and not hold the used constructor itself.""
This reintroduces commit r150682 with a fix for the Bullet benchmark crash.

llvm-svn: 150685
2012-02-16 12:22:20 +00:00
Sebastian Redl c3a3c60040 Revert "Make CXXNewExpr contain only a single initialier, and not hold the used constructor itself."
It leads to a compiler crash in the Bullet benchmark.

This reverts commit r12014.

llvm-svn: 150684
2012-02-16 11:35:52 +00:00
Sebastian Redl 86fab844bb Make CXXNewExpr contain only a single initialier, and not hold the used constructor itself.
Holding the constructor directly makes no sense when list-initialized arrays come into play. The constructor is now held in a CXXConstructExpr, if construction is what is done. The new design can also distinguish properly between list-initialization and direct-initialization, as well as implicit default-initialization constructors and explicit value-initialization constructors. Finally, doing it this way removes redundance from the AST because CXXNewExpr doesn't try to handle both the allocation and the initialization responsibilities.

This breaks the static analysis of new expressions. I've filed PR12014 to track this.

llvm-svn: 150682
2012-02-16 10:58:10 +00:00
Argyrios Kyrtzidis 3454d444dc [libclang] Do index statements inside a type source info. rdar://10872758
llvm-svn: 150647
2012-02-16 01:12:04 +00:00
David Blaikie af90ec11e1 Provide common include for all diagnostic headers.
Reviewed by Ted Kremenek.

llvm-svn: 150616
2012-02-15 21:58:34 +00:00
David Blaikie 040a3a28f1 Remove the unuseful -fdiagnostics-show-name
This option was added in r129614 and doesn't have any use case that I'm aware
of. It's possible that external tools are using these names - and if that's
the case we can certainly reassess the functionality, but for now it lets us
shave out a few unneeded bits from clang.

Move the "StaticDiagNameIndex" table into the only remaining consumer, diagtool.
This removes the actual diagnostic name strings from clang entirely.

Reviewed by Chris Lattner & Ted Kremenek.

llvm-svn: 150612
2012-02-15 19:45:34 +00:00
Richard Smith 19582e85bd Fix typo in r150549.
llvm-svn: 150555
2012-02-15 02:07:05 +00:00
Douglas Gregor 3009383b9f Implement indexing support for lambdas in libclang (both kinds), as
well as improving the RecursiveASTVisitor's walk of lambda
expressions.

llvm-svn: 150549
2012-02-15 00:54:55 +00:00
Argyrios Kyrtzidis 7e747957cd [libclang] Indexing: only index implicit template instantiations via an opt-in indexing option.
llvm-svn: 150517
2012-02-14 22:23:11 +00:00
Ted Kremenek b05119cb00 Fix use-after-free introduced by me being an idiot.
llvm-svn: 150461
2012-02-14 06:54:46 +00:00
Ted Kremenek 914c7e62e8 Implement new DiagnosticsRenderer that packages notes retrieved by clang_getDiagnosticSetFromTU() as
child diagnostics of primary diagnostics.  By using the DiagnosticRenderer, these Diagnostics now
match with those generated for serialized diagnostics.

llvm-svn: 150456
2012-02-14 02:46:03 +00:00
Dylan Noblesmith f1a13f29f2 drop more llvm:: prefixes on SmallString<>
More cleanup after r149799.

llvm-svn: 150380
2012-02-13 12:32:26 +00:00
Dylan Noblesmith 1cd1069b68 drop more llvm:: prefixes on OwningPtr<>
More cleanup after r149798.

llvm-svn: 150379
2012-02-13 12:32:21 +00:00
Argyrios Kyrtzidis d0e58e9be8 [libclang] For a reference of an implicit template instantiation just give
a reference for the instantiation decl. Also test that its location is correct
after previous commit.

llvm-svn: 150291
2012-02-11 02:00:00 +00:00
Jim Grosbach 576452b830 Have the driver pass CPU and target feature information to cc1as.
When creating the MCSubtargetInfo, the assembler driver uses the CPU and
feature string to construct a more accurate model of what instructions
are and are not legal.

rdar://10840476

llvm-svn: 150273
2012-02-10 20:37:10 +00:00
Argyrios Kyrtzidis 4701cf61d7 [libclang] Indexing API: fully index using decls and directives.
llvm-svn: 150268
2012-02-10 20:10:48 +00:00
Argyrios Kyrtzidis e5dc5b31f2 [libclang] Indexing API: Fully index implict template instantiations.
llvm-svn: 150267
2012-02-10 20:10:44 +00:00
Argyrios Kyrtzidis 1b6e5dc6a5 [libclang] Encode the template specialization parameters of a function
specialization in its USR string.

llvm-svn: 150264
2012-02-10 20:10:32 +00:00
Dylan Noblesmith 9345813ddd cmake: create a relative symlink to clang, not absolute
Hardcoding the location of the build directory seems like it would
break at `make install`/packaging time.

llvm-svn: 150201
2012-02-09 20:02:46 +00:00
Argyrios Kyrtzidis 95c0feb5e0 [libclang] Indexing: When suppressing references, suppress references
of bases in C++ classes. rdar://10768707

llvm-svn: 150048
2012-02-08 03:04:33 +00:00
Argyrios Kyrtzidis a2a299e586 [libclang] For CXXOperatorCallExprs, give a valid source location to the DeclRefExpr
that is referencing the member function, so we can index the referenced function.

Fixes rdar://10762375&10324915 & http://llvm.org/PR11192

llvm-svn: 150033
2012-02-08 01:21:13 +00:00
Argyrios Kyrtzidis ea9b81b4c6 [libclang] Do not index implicit C++ member functions. rdar://10769813
llvm-svn: 150007
2012-02-07 22:46:16 +00:00
Benjamin Kramer 7ec12c928a Revert my patches which removed Diagnostic.h includes by moving some operator overloads out of line.
This seems to negatively affect compile time onsome ObjC tests
(which use a lot of partial diagnostics I assume). I have to come
up with a way to keep them inline without including Diagnostic.h
everywhere. Now adding a new diagnostic requires a full rebuild
of e.g. the static analyzer which doesn't even use those diagnostics.

This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99.
This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789.
This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7.
This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f.
This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5.

llvm-svn: 150006
2012-02-07 22:29:24 +00:00
David Blaikie 09d20eefaa Make use of const-correct ParseCommandLineOptions
llvm-svn: 150000
2012-02-07 19:36:38 +00:00
Benjamin Kramer db0fc5131d Print NamedDecls directly to a raw_ostream where possible.
llvm-svn: 149982
2012-02-07 11:57:57 +00:00
Douglas Gregor e31e606ff3 Introduce basic ASTs for lambda expressions. This covers:
- Capturing variables by-reference and by-copy within a lambda
  - The representation of lambda captures
  - The creation of the non-static data members in the lambda class
  that store the captured variables
  - The initialization of the non-static data members from the
  captured variables
  - Pretty-printing lambda expressions

There are a number of FIXMEs, both explicit and implied, including:
  - Creating a field for a capture of 'this'
  - Improved diagnostics for initialization failures when capturing
  variables by copy
  - Dealing with temporaries created during said initialization
  - Template instantiation
  - AST (de-)serialization
  - Binding and returning the lambda expression; turning it into a
  proper temporary
  - Lots and lots of semantic constraints
  - Parameter pack captures

llvm-svn: 149977
2012-02-07 10:09:13 +00:00
Abramo Bagnara 48c05be124 Added location for template keyword in TemplateSpecializationTypeLoc. In the process removed some naming ambiguities.
llvm-svn: 149870
2012-02-06 14:41:24 +00:00
Benjamin Kramer 3307c508c9 Move various diagnostic operator<< overloads out of line and remove includes of Diagnostic.h.
Fix all the files that depended on transitive includes of Diagnostic.h.
With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer.

llvm-svn: 149781
2012-02-04 12:31:12 +00:00
Argyrios Kyrtzidis fcf8d1f82a [libclang] Stick to the silly notion that a forward class/protocol
declaration is a reference. rdar://10749990

llvm-svn: 149733
2012-02-04 01:04:58 +00:00
Jim Grosbach ff3789a6bb Pass the SourceMgr to the MCContext for cc1as.
llvm-svn: 149608
2012-02-02 17:54:07 +00:00
Abramo Bagnara 7945c981b9 Added source location for the template keyword in AST template-id expressions.
llvm-svn: 149127
2012-01-27 09:46:47 +00:00
Ted Kremenek 49db052db4 Teach ccc-analyzer about -fobjc-abi-version.
llvm-svn: 149094
2012-01-26 23:30:13 +00:00
Fariborz Jahanian 48fd81b484 objc-arc: introduce -no-finalize-removal which in gc mode,
leaves "finalize' behind and in arc mode, does not
include it. This allows the migrated source to be compiled
in both gc and arc mode. // rdar://10532441

llvm-svn: 149079
2012-01-26 20:57:58 +00:00
Argyrios Kyrtzidis be6d89d255 [driver] Do emit the diagnostics when CompilerInvocation::CreateFromArgs() fails.
llvm-svn: 148970
2012-01-25 20:00:43 +00:00
Anna Zaks b3d896d333 [analyzer] Add the HTML file to the SATest diagnostic diff.
(Uses the functionality which has been in CmpRuns long before.)

llvm-svn: 148868
2012-01-24 21:57:35 +00:00
Argyrios Kyrtzidis 3698cef19f [libclang] In clang::getCursorKindForDecl() don't return "UnexposedDecl"
for forward references of classes and protocols, this breaks libclang API usage.

rdar://10747438.

llvm-svn: 148861
2012-01-24 21:39:26 +00:00