Граф коммитов

2072 Коммитов

Автор SHA1 Сообщение Дата
Argyrios Kyrtzidis 1836db0f2c [libclang] Stick to the silly notion that a forward class/protocol
declaration is a reference. rdar://10749990

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149733 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-04 01:04:58 +00:00
Jim Grosbach 6a9a6d22d7 Pass the SourceMgr to the MCContext for cc1as.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149608 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-02 17:54:07 +00:00
Abramo Bagnara e4b92761b4 Added source location for the template keyword in AST template-id expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149127 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-27 09:46:47 +00:00
Ted Kremenek 71d9d5cb9d Teach ccc-analyzer about -fobjc-abi-version.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149094 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-26 23:30:13 +00:00
Fariborz Jahanian bbdfad581f 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149079 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-26 20:57:58 +00:00
Argyrios Kyrtzidis ada4fa7978 [driver] Do emit the diagnostics when CompilerInvocation::CreateFromArgs() fails.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148970 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-25 20:00:43 +00:00
Anna Zaks 2c3038edc2 [analyzer] Add the HTML file to the SATest diagnostic diff.
(Uses the functionality which has been in CmpRuns long before.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148868 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-24 21:57:35 +00:00
Argyrios Kyrtzidis c15707d8da [libclang] In clang::getCursorKindForDecl() don't return "UnexposedDecl"
for forward references of classes and protocols, this breaks libclang API usage.

rdar://10747438.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148861 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-24 21:39:26 +00:00
Argyrios Kyrtzidis 98c16b8b4f [libclang] When calling clang_getCursorReferenced on a class or protocol
forward reference, do give an interface or protocol cursor back, don't give
an 'UnexposedDecl' one.

rdar://10743193

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148848 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-24 19:40:15 +00:00
Argyrios Kyrtzidis 05b7846d87 [libclang] For:
@implementation I(cat)
suppress subsequent references to 'I'.

rdar://10568103

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148730 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-23 21:28:38 +00:00
Argyrios Kyrtzidis 277b156845 Introduce CXXRecordDecl::isCLike() that is true if the class is C-like,
without C++-specific features.

Use it to set the language to C++ when indexing non-C-like structs.
rdar://10732579

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148708 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-23 16:58:45 +00:00
Argyrios Kyrtzidis 145f7b2093 [libclang] Index C++ template specializations, rdar://10732708
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148707 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-23 16:58:41 +00:00
Argyrios Kyrtzidis 55fa1d9b7e [libclang] Index namespaces in C++ qualified lookup of members, rdar://10732798
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148706 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-23 16:58:38 +00:00
Argyrios Kyrtzidis 8818d4570b [libclang] Index C++ constructor initializers, rdar://10732164
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148705 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-23 16:58:36 +00:00
Sebastian Pop 9ec60dfe77 rename -ccc-host-triple into -target
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148582 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 22:01:23 +00:00
David Blaikie 3026348bd4 More dead code removal (using -Wunreachable-code)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148577 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 21:50:17 +00:00
Douglas Gregor 1f6b2b5c82 Extract the (InputKind, std::string) pair used to describe inputs to
the front end into its own class, FrontendInputFile, to make it easier
to introduce new per-input data. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148546 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 16:28:04 +00:00
Argyrios Kyrtzidis 0b28928a71 [libclang] Fix crash when indexing attributes, rdar://10702250.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148524 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 01:38:51 +00:00
Argyrios Kyrtzidis 7fe90f3bfa [libclang] Make sure Preprocessor is set in ASTUnit during indexing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148319 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 18:48:07 +00:00
David Blaikie 7530c034c0 Remove unreachable code in Clang. (replace with llvm_unreachable where appropriate or when GCC requires it)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148292 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 06:56:22 +00:00
David Blaikie 561d3abc88 Remove unnecessary default cases in switches over enums.
This allows -Wswitch-enum to find switches that need updating when these enums are modified.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148281 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 02:30:50 +00:00
Argyrios Kyrtzidis 5e192a7d60 [libclang] Make clang_getCursorCompletionString not depend on the ASTUnit having
a Sema.

This allows it to work when Sema is not available, like when loading AST files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148279 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 02:15:54 +00:00
Douglas Gregor ef96ee0be5 De-virtualize getPreviousDecl() and getMostRecentDecl() when we know
we have a redeclarable type, and only use the new virtual versions
(getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have
that type information. This keeps us from penalizing users with strict
type information (and is the moral equivalent of a "final" method).

Plus, settle on the names getPreviousDecl() and getMostRecentDecl()
throughout.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148187 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-14 16:38:05 +00:00
Argyrios Kyrtzidis db4d7a5f47 [libclang] If CXIndexOpt_IndexFunctionLocalSymbols is enabled, also
index parameters.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148169 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-14 02:05:51 +00:00
Argyrios Kyrtzidis 22490747c1 [libclang] Add CXIndexOpt_IndexFunctionLocalSymbols indexing option to indicate
that one wants indexing callbacks for function-local symbols as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148160 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-14 00:11:49 +00:00
Eli Friedman 31cbe68430 Revert r148138; it's causing test failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148141 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-13 21:33:06 +00:00
Sebastian Pop edd4f3c391 rename -ccc-host-triple into -target
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148138 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-13 20:37:02 +00:00
Rafael Espindola b29d3e73aa Revert 148045 to fix the bots.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148049 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-12 21:17:34 +00:00
Rafael Espindola 9f141c4be1 Add a SONAME to the libclang library.
Patch by Sylvestre Ledru.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148045 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-12 21:04:54 +00:00
Argyrios Kyrtzidis 746f5bcbfd Add IsImplicit field in ObjCMessageExpr that is true when the message
was constructed, e.g. for a property access.

This allows the selector identifier locations machinery for ObjCMessageExpr
to function correctly, in that there are not real locations to handle/report for
such a message.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148013 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-12 02:34:39 +00:00
Anna Zaks f46ca24d66 [analyzer] Correct the c++-analyzer symlink
As Matt pointed out, this should be just a link to 'ccc-analyzer'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147661 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 17:11:23 +00:00
Anna Zaks e0e7c99410 [analyzer] c++-analyzer should be a symlink.
This fixes a regression from r147643.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147648 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 02:19:07 +00:00
Anna Zaks a772b86a6e [analyzer] Update the docs to reflect that gcc is not the only default
compiler option.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147645 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 01:54:08 +00:00
Anna Zaks dd40b84040 [analyzer] scan-build: If we are on MacOS, use clang as the default
compiler.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147644 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 01:54:05 +00:00
Anna Zaks f5c5f89a10 [analyzer] Skip --serialize-diagnostic when running scan-build.
Otherwise, the analyzer will try to analyze the serialized diagnostic
file as if it were a source file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147643 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 01:54:02 +00:00
Ted Kremenek 5a15d92206 Force set-xcode-analyzer to use the system version of Python installed on OS X.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147483 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-03 22:05:57 +00:00
Douglas Gregor c9d3c7edb5 Eliminate the ForwardDecl/InitiallyForwardDecl bits from ObjCProtocolDecl. They are no longer needed
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147419 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 22:06:18 +00:00
Douglas Gregor bd9482d859 Eliminate ObjCForwardProtocolDecl, which is redundant now that
ObjCProtocolDecl modules forward declarations properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147415 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 21:23:57 +00:00
Douglas Gregor 5e2a1ff9f2 Move the data that corresponds to the definition of a protocol into a
separately-allocated DefinitionData structure. Introduce various
functions that will help with the separation of declarations from
definitions (isThisDeclarationADefinition(), hasDefinition(),
getDefinition()).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147408 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 19:29:29 +00:00
Douglas Gregor 375bb1413c Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDecl
covers both declarations (@class) and definitions (@interface) of an
Objective-C class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147299 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-27 22:43:10 +00:00
Dylan Noblesmith 89ea416d3f driver: fix unused variable warning
from r147218.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147278 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-26 19:29:47 +00:00
Dylan Noblesmith 8fdb6dee2d Let CompilerInvocation initialization indicate failure
This fixes the FIXMEs in ParseAnalyzeArgs. (Also a
precursor to moving the analyzer into an AST plugin.)

For consistency, do the same with AssemblerInvocation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147218 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-23 03:05:38 +00:00
Dylan Noblesmith 1770e0dadc remove unneeded config.h includes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147195 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-22 22:49:47 +00:00
Kevin Enderby 567003e572 Last part of support for generating dwarf for assembly source files. This gets
the clang driver to enable this when assembling a .s file.  rdar://9275556


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147167 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-22 19:31:58 +00:00
Argyrios Kyrtzidis acca41167c [libclang] In visitPreprocessedEntitiesInRange we are interested in a file region
so translate the range to file locations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147058 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-21 16:56:38 +00:00
Douglas Gregor 7723fec9b4 Keep track of all declarations of an Objective-C class (both forward
declarations and definitions) as ObjCInterfaceDecls within the same
redeclaration chain. This new representation matches what we do for
C/C++ variables/functions/classes/templates/etc., and makes it
possible to answer the query "where are all of the declarations of
this class?"



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146679 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-15 20:29:51 +00:00
Argyrios Kyrtzidis db7a800e0b [libclang] Give up on using write(); hopefully unbreaks mingw build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146648 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-15 06:51:30 +00:00
Argyrios Kyrtzidis 53ba95612c Revert r146646 that was a mistake, and make the intended change in the right file.
Log:
[libclang] Try to unbreak mingw build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146647 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-15 05:53:37 +00:00
Douglas Gregor 2e5c15be82 Move the definition-specific data of ObjCInterfaceDecl into a
separately-allocated DefinitionData structure, which we manage the
same way as CXXRecordDecl::DefinitionData. This prepares the way for
making ObjCInterfaceDecls redeclarable, to more accurately model
forward declarations of Objective-C classes and eliminate the mutation
of ObjCInterfaceDecl that causes us serious trouble in the AST reader.

Note that ObjCInterfaceDecl's accessors are fairly robust against
being applied to forward declarations, because Clang (and Sema in
particular) doesn't perform RequireCompleteType/hasDefinition() checks
everywhere it has to. Each of these overly-robust cases is marked with
a FIXME, which we can tackle over time.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146644 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-15 05:27:12 +00:00
Argyrios Kyrtzidis fa39f5b76b [libclang] Install a fatal error handler that will call abort() instead of exit()
when there is a report_fatal_error() call.

rdar://10507984

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146641 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-15 04:52:41 +00:00
Argyrios Kyrtzidis 643d3ce93c [libclang] Indexing API: provide an attribute list inside CXIdxEntityInfo
so that we can access the attributes of an entity for a reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146616 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-15 00:05:00 +00:00
Argyrios Kyrtzidis 90fd67af4a [libclang] Suppress indexing references for occurrences of the interface
in a superclass and the protocols in a protocol list.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146615 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-15 00:04:56 +00:00
Douglas Gregor af764723bf Eliminate the vistigial ObjCClassDecl::ObjCClassRef, and inline its
members into ObjCClassDecl, saving ourselves one pointer per forward
declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146564 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-14 17:12:03 +00:00
Argyrios Kyrtzidis c10a4c8baf [libclang] Indexing API: Provide the protocols list for objc categories as well.
rdar://10573361

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146498 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-13 18:47:45 +00:00
Argyrios Kyrtzidis e422e45a6a [libclang] Indexing API: Fix indexing of missed references.
rdar://10567864&10567916

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146497 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-13 18:47:41 +00:00
Argyrios Kyrtzidis c2be04eaec [libclang] Indexing API: Fix suppressing of references in macros and suppress
@class forward references.

rdar://10568080&10568103&10568119

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146496 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-13 18:47:35 +00:00
Argyrios Kyrtzidis 16ed0e6fda [libclang] Add defensive checks to make sure we don't try to dereference
a null pointer after getCursorDecl() is called. rdar://10298421.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146312 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 02:36:25 +00:00
Ted Kremenek 0373fcc3e5 Add clang_getDiagnosticSetFromTU() to libclang. Fixes <rdar://problem/10553081>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146287 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 22:28:32 +00:00
Ted Kremenek 52a9b5aa5d Sort exports list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146286 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 22:28:29 +00:00
Argyrios Kyrtzidis c6994005dc Save category name loc in ObjCCategoryImplDecl, patch by Jason Haslam!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146213 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 00:31:40 +00:00
Argyrios Kyrtzidis 4451746d8f [libclang] Make sure we don't try to handle a CXCursor_NoDeclFound
passed to clang_findReferencesInFile.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146211 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-09 00:17:49 +00:00
Eli Friedman 6d402dc963 Misc Minix-specific changes to clang:
. move compiler-rt to a separate directory so the -L argument only includes compiler-rt (thanks joerg)
. build all clang subdirs
. switches the Minix platform to ELF
. normalizes toolchain invocation

Patch by Ben Gras.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146206 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-08 23:54:21 +00:00
Argyrios Kyrtzidis e368a641a0 [libclang] When doing clang_findReferencesInFile, make sure we don't crash
if we come up against a null Decl.

No test case unfortunately. rdar://10457799.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146127 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-08 01:56:07 +00:00
Argyrios Kyrtzidis bb7f5420bd [libclang] Remove IndexingContext's getScopedContext(), it's not useful
now that client containers can be set via function calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146117 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-08 00:54:07 +00:00
Argyrios Kyrtzidis b1febb646b [libclang] Indexing API: provide both the semantic and the lexical container.
They are generally the same except in C++ cases like out-of-line member functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146069 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-07 20:44:19 +00:00
Argyrios Kyrtzidis b526a871af [libclang] Fix indexing of C++ bases in a C++ class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146068 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-07 20:44:15 +00:00
Argyrios Kyrtzidis 838d3c2320 [libclang] Introduce CXIdxEntityLanguage that indicates the language
of an indexed entity.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146067 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-07 20:44:12 +00:00
Argyrios Kyrtzidis 68478b0cc1 [libclang] Index C++ namespaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146019 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-07 05:52:06 +00:00
Ted Kremenek 13eee19646 Tweak serialized diagnostics to support errors with no categories. Fixes <rdar://problem/10538300>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146011 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-07 02:08:00 +00:00
Argyrios Kyrtzidis 84b796492d [libclang] API enhancements by Joe Groff!
- Exposes a CXType_Vector type kind for vector types.
- Adds generalized versions of the clang_getArrayElementType and clang_getArraySize functions, named clang_getElementType and clang_getNumElements, which work on array, vector, or complex types.
- Adds additional functions for querying function types. clang_isFunctionTypeVariadic returns true if a function type is variadic. clang_getFunctionCallingConv returns an enumeration value indicating the calling convention of the function type. clang_getNumArgTypes returns the number of static argument types, and clang_getArgType gets the type of an argument.
- Adds a clang_getTypedefDeclUnderlyingType function to get the underlying type from a TypedefDecl cursor.
- Adds a clang_getEnumDeclIntegerType function to get the integer type from an EnumDecl cursor.
- Adds clang_getEnumConstantDeclValue and clang_getEnumConstantDeclUnsignedValue functions to get the value of an EnumConstantDecl as a signed or unsigned long long, respectively.
- Exposes a CXCursor_AsmLabelAttr cursor kind for __asm__("label") attributes.
- Alters clang_getCursorSpelling to return the label value for AsmLabelAttr-kind cursors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145972 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-06 22:05:01 +00:00
Argyrios Kyrtzidis da5f2d2360 [libclang] When indexing a field in a C++ class, return an entity
of kind CXIdxEntity_CXXInstanceVariable. rdar://10522503.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145859 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-05 22:05:28 +00:00
Argyrios Kyrtzidis d977e6b0eb [libclang] Fix infinite loop when doing visitation of an OpaqueValueExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145751 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-03 03:49:47 +00:00
Argyrios Kyrtzidis dcbb2fb871 [libclang] Allow indexing/get-cursor/etc. for the exception variable in a C++ catch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145750 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-03 03:49:44 +00:00
Douglas Gregor 15de72cf58 Introduce a module import declaration, so that we properly represent, e.g.,
__import_module__ std.vector;

in the AST.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145725 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-02 23:23:56 +00:00
Argyrios Kyrtzidis 996e6e564a [libclang] Create a diagnostic set to pass at the end of indexing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145557 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-01 02:42:50 +00:00
Argyrios Kyrtzidis 5c2a1f741e [libclang] Do the ConcurrencyCheck at the beginning of clang_findReferencesInFile.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145455 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 23:21:50 +00:00
Benjamin Kramer 3267e11b4b Preserve constness.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145397 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 12:31:20 +00:00
Benjamin Kramer 85224ae68a Silence GCC warnings, RefCountedBase is meant to be default-initialized here.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145396 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 11:31:35 +00:00
Argyrios Kyrtzidis 7383550585 [libclang] Fix leak in clang_indexSourceFile_Impl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145393 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 08:14:50 +00:00
Argyrios Kyrtzidis b49e728a4d [libclang] Make clang_findReferencesInFile also work on macros (find all expansions/definition
of a macro in a file).

As a bonus, also make searching for declarations more efficient by ignoring
preprocessing entities when we know that we are looking for a declaration.

Fixes rdar://10427411.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145369 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 03:14:11 +00:00
Ted Kremenek 952538d48d Fix serialized diagnostics to handle FixIts that only remove text. Fixes <rdar://problem/10473903>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145339 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 00:30:52 +00:00
Argyrios Kyrtzidis ed8bef44c0 [libclang] Protect against the declaration's SourceRange being invalid
before passing to RangeCompare.

Though no idea how this can occur with the decls returned from
findFileRegionDecls().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145301 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-28 22:38:07 +00:00
Bob Wilson 3e627ae2a9 Install c-index-test and clang-c/Index.h as internal files. rdar://10217046
Specify that these files should be installed to the optional internal
install location as specified by configure's --with-internal-prefix.
If that option is not used, they'll be installed to the default prefix
as before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145235 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-28 08:03:54 +00:00
Argyrios Kyrtzidis 6f3ce979a7 [libclang] Indexing API: If the client requested to get a CXTranslationUnit after
indexing, honor all the TU options.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145229 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-28 04:56:00 +00:00
Argyrios Kyrtzidis 991bf49f68 [libclang] Indexing API: Capture diagnostics during indexing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145228 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-28 04:55:55 +00:00
Argyrios Kyrtzidis c14a03dfff [libclang] Fix operations (token annotation, getting cursor, etc.) with a file region
inside an objc container that "contains" other file-level declarations.

When getting the array of file-level declarations that overlap with a file region,
we failed to report that the region overlaps with an objc container, if
the container had other file-level declarations declared lexically inside it.

Fix this by marking such declarations as "isTopLevelDeclInObjCContainer" in the AST
and handling them appropriately.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145109 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-23 20:27:36 +00:00
Argyrios Kyrtzidis 37f40572c4 [libclang] Indexing API: Fix issues, mostly C++ related.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145107 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-23 20:27:26 +00:00
Argyrios Kyrtzidis 2957e6f8c4 [libclang] Indexing API: Support C++ symbols.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145058 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-22 07:24:51 +00:00
Peter Collingbourne 82c3460326 Create the clang++ symlink as a POST_BUILD custom command on clang.
This saves us from re-creating the symlink on every build even if we
didn't rebuild clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145017 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-21 00:00:48 +00:00
NAKAMURA Takumi 87adb0bf93 c-index-test.c: Fix syntax according to C.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144947 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-18 00:51:03 +00:00
Argyrios Kyrtzidis 88c2596edc Change ASTConsumer::HandleTopLevelDecl to return true for the parser to continue
parsing or false to abort parsing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144943 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-18 00:26:59 +00:00
Argyrios Kyrtzidis b395c63b47 [libclang] Indexing API:
-For indexDeclaration, also pass the declaration attributes as an array of cursors.
-Rename CXIndexOpt_OneRefPerFile -> CXIndexOpt_SuppressRedundantRefs, and only pass
  a reference if a declaration/definition does not exist in the file.
-Other fixes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144942 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-18 00:26:51 +00:00
Argyrios Kyrtzidis 144b6c0c50 [libclang] Indexing API: make sure we don't pass declarations/references without USR or location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144941 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-18 00:26:46 +00:00
Ted Kremenek d3b74d9ca4 Make 'LangOptions' in CompilerInvocation a heap-allocated, reference counted object. I discovered that llvm::RefCountedBase<T> has
a bug where the reference count is copied in the copy constructor, which means that there were cases when the CompilerInvocation
objects created by ASTUnit were actually leaked.  When I fixed that bug locally, it showed that a whole bunch of code assumed
that the LangOptions object that was part of CompilerInvocation was still alive.  By making it heap-allocated and reference counted,
we can keep it around after the CompilerInvocation object goes away.

As part of this change, change CompilerInvocation:getLangOptions() to return a pointer, acting as another clue that this
object may outlive the CompilerInvocation object.

This commit doesn't fix the CompilerInvocation leak itself.  That will come when I commit the fix to llvm::RefCountedBase<T> to
mainline LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144930 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-17 23:01:24 +00:00
Argyrios Kyrtzidis c88e58c0db [libclang] Add a comment in lazyCreateDiags to explain why the check and reset of
diagnostic set is necessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144793 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-16 08:59:00 +00:00
Argyrios Kyrtzidis 03ee2dd9fc [libclang] Make clang_annotateTokens use "file-targeted" deserialization and avoid
unnecessary deserializations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144792 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-16 08:58:57 +00:00
Argyrios Kyrtzidis e2079cf54d [libclang] Make clang_findReferencesInFile use "file-targeted" deserialization and avoid
unnecessary deserializations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144791 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-16 08:58:54 +00:00
Ted Kremenek de19bb1f03 Teach ccc-analyzer about -fobjc-arc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144778 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-16 05:14:42 +00:00
Argyrios Kyrtzidis 3e340a67f4 [libclang] Indexing API: fill the objc category info for a category implementation and
do not crash if no client container is registered for a declaration context.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144765 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-16 02:35:05 +00:00
Argyrios Kyrtzidis d6c8209fd1 [libclang] Indexing API: make sure we do not try to index local declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144764 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-16 02:35:01 +00:00