Commit Graph

657 Commits

Author SHA1 Message Date
Douglas Gregor 3a5d6c27b2 If code completion patterns are not enabled, use simpler else/else if
completions that don't insert braces. Fixes <rdar://problem/10764168>.

llvm-svn: 150707
2012-02-16 17:49:04 +00:00
Argyrios Kyrtzidis 85620ad239 Fix the RecursiveASTVisitor to not traverse C++ default parameters twice.
llvm-svn: 150651
2012-02-16 02:02:14 +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
Douglas Gregor d8c61785ed Implement code completion support for lambda capture lists.
llvm-svn: 150583
2012-02-15 15:34:24 +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
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
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 e6a90e3c3d [libclang] Add a libclang test I neglected to commit.
llvm-svn: 150193
2012-02-09 18:31:22 +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 b6c6a58366 Make parsing of objc @implementations more robust.
Parsing of @implementations was based on modifying global state from
the parser; the logic for late parsing of methods was spread in multiple places
making it difficult to have a robust error recovery.

  -it was difficult to ensure that we don't neglect parsing the lexed methods.
  -it was difficult to setup the original objc container context for parsing the lexed methods
   after completing ParseObjCAtImplementationDeclaration and returning to top level context.

Enhance parsing of @implementations by centralizing it in Parser::ParseObjCAtImplementationDeclaration().
ParseObjCAtImplementationDeclaration now returns only after an @implementation is fully parsed;
all the data and logic for late parsing of methods is now in one place.

This allows us to provide code-completion for late parsed methods with mis-matched braces.
rdar://10775381

llvm-svn: 149987
2012-02-07 16:50:53 +00:00
Ted Kremenek 7f4bd16b53 Per discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.
llvm-svn: 149566
2012-02-02 00:16:13 +00:00
Douglas Gregor d3cebdba41 When providing code completions for a switch over a scoped enumeration
type, be sure to add the qualifier for the enumeration type.

llvm-svn: 149471
2012-02-01 05:02:47 +00:00
Douglas Gregor 4f39919f38 Update line numbers. Sigh
llvm-svn: 149202
2012-01-29 20:05:18 +00:00
Douglas Gregor 65412ec682 Also require a proper shell
llvm-svn: 149201
2012-01-29 20:04:46 +00:00
Douglas Gregor e1fbde55dd Ensure that we clean up after a failed module build and cope with the
results in libclang.

llvm-svn: 149200
2012-01-29 19:57:03 +00:00
Douglas Gregor 07f4357b44 Implement code completion support for module import declarations, e.g.,
@import <complete with module names here>

or

  @import std.<complete with submodule names here>

Addresses <rdar://problem/10710117>.

llvm-svn: 149199
2012-01-29 18:15:03 +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
Douglas Gregor 1cc88a977c Handle pseudo-object expressions (and any other placeholder
expression) when code-completing member access expressions. Fixes
<rdar://problem/10717172>.

llvm-svn: 148703
2012-01-23 15:59:30 +00:00
Douglas Gregor 3aa55267c4 Fix the code completion string for variadic macros with more than one
argument, which was broken and very ugly (and even had a test case to
make *sure* it was broken and ugly). Fixes <rdar://problem/10609117>.

llvm-svn: 148606
2012-01-21 00:43:38 +00:00
Bob Wilson 1052b0c467 Remove unnecessary and incorrect redirection of stderr.
llvm-svn: 148583
2012-01-20 22:01:45 +00:00
Sebastian Pop 422377cfd3 rename -ccc-host-triple into -target
llvm-svn: 148582
2012-01-20 22:01:23 +00:00
Argyrios Kyrtzidis 908c4dcc5d [libclang] Fix crash when indexing attributes, rdar://10702250.
llvm-svn: 148524
2012-01-20 01:38:51 +00:00
Eli Friedman d749c6bf2e Revert r148138; it's causing test failures.
llvm-svn: 148141
2012-01-13 21:33:06 +00:00
Sebastian Pop 9a8d528ddf rename -ccc-host-triple into -target
llvm-svn: 148138
2012-01-13 20:37:02 +00:00
Douglas Gregor deafd0b2a4 Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDecl
covers both declarations (@class) and definitions (@interface) of an
Objective-C class.

llvm-svn: 147299
2011-12-27 22:43:10 +00:00
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