Commit Graph

631 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 2403797eec For SourceManager::isBeforeInTranslationUnit(), have it consider macro arg expanded
token locations as coming before the closing ')' of a function macro expansion.

Include a unit test for SourceManager.

llvm-svn: 147056
2011-12-21 16:56:29 +00:00
Douglas Gregor dc9166c8e1 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?"

llvm-svn: 146679
2011-12-15 20:29:51 +00:00
Argyrios Kyrtzidis 41cfce25fe [libclang] Suppress indexing references for occurrences of the interface
in a superclass and the protocols in a protocol list.

llvm-svn: 146615
2011-12-15 00:04:56 +00:00
Argyrios Kyrtzidis 25cb0ff3d8 [libclang] Indexing API: Fix indexing of missed references.
rdar://10567864&10567916

llvm-svn: 146497
2011-12-13 18:47:41 +00:00
Argyrios Kyrtzidis ccdf8276a3 [libclang] Indexing API: Fix suppressing of references in macros and suppress
@class forward references.

rdar://10568080&10568103&10568119

llvm-svn: 146496
2011-12-13 18:47:35 +00:00
Argyrios Kyrtzidis 66f433a746 [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.

llvm-svn: 145972
2011-12-06 22:05:01 +00:00
Erik Verbruggen c6c8d9356d Extend warnings for missing '@end'.
Fixes PR2709.

llvm-svn: 145928
2011-12-06 09:25:23 +00:00
Argyrios Kyrtzidis b2b0795c9f [PCH] Make sure that the SourceExpr of a OpaqueValueExpr is always initialized
when deserialized, fixing random crashes in libclang.

Also simplifies how OpaqueValueExprs are [de]serialized.
The reader/writer automatically retains pointer equality of sub-statements (when a
statement node is referenced in multiple nodes), so no need to manually handle it.

llvm-svn: 145752
2011-12-03 03:49:52 +00:00
Argyrios Kyrtzidis 0042b6f925 [libclang] Fix infinite loop when doing visitation of an OpaqueValueExpr.
llvm-svn: 145751
2011-12-03 03:49:47 +00:00
Argyrios Kyrtzidis 0fd8fae0a6 [libclang] Allow indexing/get-cursor/etc. for the exception variable in a C++ catch.
llvm-svn: 145750
2011-12-03 03:49:44 +00:00
Argyrios Kyrtzidis 79d0428046 ParmVarDecls have no linkage. Previously we would report that parameters
in type signatures have external linkage.

Fixes rdar://10058317.

llvm-svn: 145551
2011-12-01 01:28:21 +00:00
Lang Hames d8bcb2b808 Test case for fix committed in r145441.
llvm-svn: 145534
2011-11-30 23:03:25 +00:00
Richard Smith 507840dbff Revert r145244. It causes us to create broken ASTs with missing type information
for some cast expressions.

Original commit message:

Removed useless ImplicitCast nodes in explicit cstyle and static casts

llvm-svn: 145447
2011-11-29 22:48:16 +00:00
Argyrios Kyrtzidis c36d6a1696 [libclang] Make the test portable.
llvm-svn: 145377
2011-11-29 05:48:01 +00:00
Argyrios Kyrtzidis 1ddb97ec86 [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.

llvm-svn: 145369
2011-11-29 03:14:11 +00:00
Nicola Gigante 13b6a2ae04 Removed useless ImplicitCast nodes in explicit cstyle and static casts
llvm-svn: 145244
2011-11-28 12:21:57 +00:00
Argyrios Kyrtzidis a72450057b [PCH] Check for isTopLevelDeclInObjCContainer when picking abbreviations.
llvm-svn: 145110
2011-11-23 21:11:23 +00:00
Argyrios Kyrtzidis 8ad3bab505 [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.

llvm-svn: 145109
2011-11-23 20:27:36 +00:00
Argyrios Kyrtzidis 463741a5a2 [libclang] Make clang_annotateTokens use "file-targeted" deserialization and avoid
unnecessary deserializations.

llvm-svn: 144792
2011-11-16 08:58:57 +00:00
Argyrios Kyrtzidis c504eb3448 [libclang] Make clang_findReferencesInFile use "file-targeted" deserialization and avoid
unnecessary deserializations.

llvm-svn: 144791
2011-11-16 08:58:54 +00:00
Argyrios Kyrtzidis 516eec2d8b [libclang] Fix crash on invalid code. Fixes rdar://10451854
llvm-svn: 144766
2011-11-16 02:35:10 +00:00
Argyrios Kyrtzidis f03e734876 [libclang] In lazyCreateDiags, recreate the diagnostic set if the number of diagnostics
in the ASTUnit changed.

llvm-svn: 144762
2011-11-16 02:34:55 +00:00
Argyrios Kyrtzidis f5ab0345fc [PCH] When chaining a PCH and serializing HeaderSearch, make sure the HeaderFileInfos
from the primary PCH is deserialized, otherwise we lose info that headers were
already #imported/#included.

llvm-svn: 144510
2011-11-13 22:08:39 +00:00
Douglas Gregor 407d1f9624 Introduce proper spacing after the Objective-C parameter qualifiers
(bycopy, inout, etc.). Fixes <rdar://problem/10402900>.

llvm-svn: 144157
2011-11-09 02:13:45 +00:00
Argyrios Kyrtzidis c137d0d62f [PCH] Fix reading from PCH of diagnostic pragmas.
In certain cases ASTReader would call the normal DiagnosticsEngine API to initialize
the state of diagnostic pragmas but DiagnosticsEngine would try to compare source locations
leading to crash because the main FileID was not yet initialized.

Yet another case of the ASTReader trying to use the normal APIs and inadvertently breaking
invariants. Fix this by having the ASTReader set up the internal state directly.

llvm-svn: 144153
2011-11-09 01:24:17 +00:00
Douglas Gregor 80357c6227 Add missing part of test
llvm-svn: 143985
2011-11-07 18:54:12 +00:00
Douglas Gregor 61d63d0fd7 ASTConsumer::handleTopLevelDecl will end up getting called for
function template instantiations. Fixes <rdar://problem/10398005> / PR11312.

llvm-svn: 143984
2011-11-07 18:53:57 +00:00
Argyrios Kyrtzidis f50f7b2c65 [libclang] Fix crash when a #pragma diagnostic is included in the preamble.
A PCH file keeps track of #pragma diagnostics state; when loading the preamble, they conflicted
with the #pragma diagnostic state already present in the DiagnosticsEngine object due to
parsing the preamble.

Fix this by clearing the state of the DiagnosticsEngine object.
Fixes rdar://10363572 && http://llvm.org/PR11254.

llvm-svn: 143644
2011-11-03 20:28:19 +00:00
Douglas Gregor 7f763f1018 Force test to use the non-fragile ABI
llvm-svn: 143642
2011-11-03 19:58:50 +00:00
Argyrios Kyrtzidis 04cf92fe7c [libclang] Make sure pointing inside the #include of the fields will return the struct.
llvm-svn: 143638
2011-11-03 19:02:30 +00:00
Argyrios Kyrtzidis deb47d17dd [libclang] Add a test for "targeting" a field inside an #include that only
contains fields.

llvm-svn: 143636
2011-11-03 19:01:07 +00:00
Douglas Gregor 21ceb18429 Extend IsSimplyAccessible to check for Objective-C instance variable
accessibility. Fixes <rdar://problem/3727335>.

llvm-svn: 143635
2011-11-03 19:00:24 +00:00
Argyrios Kyrtzidis e968152564 [libclang] Add infrastructure to be able to only deserialize decls in a file region and
use it for clang_getCursor.

llvm-svn: 143605
2011-11-03 02:20:32 +00:00
Douglas Gregor 2e10cf9620 Add a printing policy flag to suppress printing "<anonymous>::" prior
to types. Enable this flag for code completion, where knowing whether
something is in an anonymous or inline namespace is actually not
useful, since you don't have to type it anyway. Fixes
<rdar://problem/10208818>.

llvm-svn: 143599
2011-11-03 00:16:13 +00:00
Douglas Gregor e7f0675672 Test code completion for constructor initializers within the class
definition. This already worked; <rdar://problem/10208871>.

llvm-svn: 143595
2011-11-02 23:39:56 +00:00
Argyrios Kyrtzidis 1f49cda14f [libclang] Fix non-darwin buildbots.
llvm-svn: 143477
2011-11-01 19:47:41 +00:00
Argyrios Kyrtzidis b9689bb46f [libclang] For a class extension, give it a unique USR but for any property or ivar
it contains give it a USR based on its semantic context, which is the interface.

This follows what we already did for objc methods. rdar://10371669

llvm-svn: 143464
2011-11-01 17:14:12 +00:00
Ted Kremenek bc2dac225a Mark these tests as requiring use of the shell.
llvm-svn: 143150
2011-10-27 21:50:13 +00:00
Ted Kremenek 06b4f919e8 Move ASTUnit's handling of temporary files and the preamble file into a lazily-created static DenseMap. This DenseMap is cleared (and the files erased) via an atexit routine in the case an ASTUnit is not destroyed. Fixes <rdar://problem/10293367>.
llvm-svn: 143115
2011-10-27 17:55:18 +00:00
Douglas Gregor 7c81c70b03 Disalbe more Microsoft-specific stuff.
llvm-svn: 143077
2011-10-26 23:19:04 +00:00
Douglas Gregor 69d28ed013 Try to appease the Windows builders
llvm-svn: 143048
2011-10-26 20:33:43 +00:00
Douglas Gregor 3e30010d99 Eliminate a hang while loading a sequence of redeclarable entities. In
essence, the redeclaration chain for a class could end up in an
inconsistent state while deserializing multiple declarations in that
chain, where the circular linked list was not, in fact,
circular. Since only two redeclarations of the same entity will get
loaded when we're in this state, restore circularity when both have
been loaded. Fixes <rdar://problem/10324940> / PR11195.

llvm-svn: 143037
2011-10-26 17:53:41 +00:00
Douglas Gregor f44bac2b4c Turn off delayed template parsing for this test
llvm-svn: 142951
2011-10-25 20:12:15 +00:00
Douglas Gregor deb4a2be67 Implement support for dependent Microsoft __if_exists/__if_not_exists
statements. As noted in the documentation for the AST node, the
semantics of __if_exists/__if_not_exists are somewhat different from
the way Visual C++ implements them, because our parsed-template
representation can't accommodate VC++ semantics without serious
contortions. Hopefully this implementation is "good enough".

llvm-svn: 142901
2011-10-25 01:33:02 +00:00
Douglas Gregor dab63c1434 Tweak this test to test more directly what we want, and hopefully work around the brokenness of code completion under -fdelayed-template-parsing
llvm-svn: 142472
2011-10-19 04:17:22 +00:00
Douglas Gregor 7c0fc61faa Minor tweak to test
llvm-svn: 142427
2011-10-18 21:43:22 +00:00
Douglas Gregor e5c79d5ea8 Provide result types for code completions that describe built-in
expressions (this, sizeof, etc.).

llvm-svn: 142424
2011-10-18 21:20:17 +00:00
Argyrios Kyrtzidis 098c4eabd2 [libclang] Since an objc extension semantically continues the interface of the class
don't use unique USRs for them, otherwise we fail to associate @implementation methods
with the methods in extensions.

llvm-svn: 142361
2011-10-18 16:50:06 +00:00
Douglas Gregor 4205feffcd Add code completions for C++0x expressions
llvm-svn: 142357
2011-10-18 16:29:03 +00:00
Douglas Gregor d793e7c3f7 Don't format the code completion for parameters of block literal
arguments as block literal arguments; the block literal argument code
completion should only go one level deep. Fixes <rdar://problem/10291294>.

llvm-svn: 142335
2011-10-18 04:23:19 +00:00