summaryrefslogtreecommitdiffstats
path: root/clang/test/Index
Commit message (Collapse)AuthorAgeFilesLines
* New libclang API to expose container type for code completion, fromDouglas Gregor2011-07-213-0/+28
| | | | | | Connor Wakamo! llvm-svn: 135651
* Revamp the SourceManager to separate the representation of parsedDouglas Gregor2011-07-192-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | source locations from source locations loaded from an AST/PCH file. Previously, loading an AST/PCH file involved carefully pre-allocating space at the beginning of the source manager for the source locations and FileIDs that correspond to the prefix, and then appending the source locations/FileIDs used for parsing the remaining translation unit. This design forced us into loading PCH files early, as a prefix, whic has become a rather significant limitation. This patch splits the SourceManager space into two parts: for source location "addresses", the lower values (growing upward) are used to describe parsed code, while upper values (growing downward) are used for source locations loaded from AST/PCH files. Similarly, positive FileIDs are used to describe parsed code while negative FileIDs are used to file/macro locations loaded from AST/PCH files. As a result, we can load PCH/AST files even during parsing, making various improvemnts in the future possible, e.g., teaching #include <foo.h> to look for and load <foo.h.gch> if it happens to be already available. This patch was originally written by Sebastian Redl, then brought forward to the modern age by Jonathan Turner, and finally polished/finished by me to be committed. llvm-svn: 135484
* When creating a property in a class extension, make sure to check itsDouglas Gregor2011-07-151-0/+11
| | | | | | attributes. Fixes <rdar://problem/9561076>. llvm-svn: 135273
* Update all of the libclang code corresponding to the preprocessorChandler Carruth2011-07-145-23/+23
| | | | | | | | | | | | | | MacroInstantiation -> MacroExpansion rename. Internally, everything is switched. Introduce a new cursor kind enum with the new name, but retain the old name as an alias so that we don't break backwards compatibility. Also update the debug printing routine to use 'macro expansions' as its explicitly not guaranteed to be stable, and mechanically switch the test cases over to that. llvm-svn: 135140
* Introduce a new libclang aPI function,Douglas Gregor2011-07-072-2/+23
| | | | | | | | | clang_codeCompleteGetContexts(), that provides the client with information about the context in which code completion has occurred and what kinds of entities make sense as completions at that point. Patch by Connor Wakamo! llvm-svn: 134615
* Keep track of when "unrecoverable" errors occur, then allowDouglas Gregor2011-07-061-0/+15
| | | | | | | clang_saveTranslationUnit() to save a PCH file if the only errors it contains are recoverable errors. Fixes <rdar://problem/9727804>. llvm-svn: 134503
* [libclang] Avoid having the cursor of an expression replace the declaration ↵Argyrios Kyrtzidis2011-06-271-0/+7
| | | | | | | | | | | | | | | cursor when the expression source range overlaps the declaration range. This can happen for C++ constructor expressions whose range generally include the variable declaration, e.g.: MyCXXClass foo; // Make sure pointing at 'foo' returns a VarDecl cursor. rdar://9124499. llvm-svn: 133930
* [libclang] Avoid having the cursor of an expression "overwrite" the ↵Argyrios Kyrtzidis2011-06-271-2/+6
| | | | | | | | | | | | | | | annotation of the variable declaration that it belongs to. This can happen for C++ constructor expressions whose range generally include the variable declaration, e.g.: MyCXXClass foo; // Make sure we don't annotate 'foo' as a CallExpr cursor. rdar://9124499. llvm-svn: 133929
* Automatic Reference Counting.John McCall2011-06-154-2/+63
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Update Indexer test for new 'atomic' keyword.Fariborz Jahanian2011-06-131-2/+14
| | | | llvm-svn: 132918
* Add code completetion code for the new 'atomic' attributeFariborz Jahanian2011-06-111-0/+1
| | | | | | keyword in objc property decl. llvm-svn: 132877
* Expose @synthesize and @dynamic via their own cursor kinds inDouglas Gregor2011-06-033-6/+6
| | | | | | libclang. Fixes <rdar://problem/9537904>. llvm-svn: 132603
* Tweak code completions for Objective-C Key-Value Observing. TheDouglas Gregor2011-06-021-1/+3
| | | | | | | | +keyPathsForValuesAffecting<Key> completion was mislabeled as an instance method, and +automaticallyNotifiesObserversOf<Key> was missing entirely. Fixes <rdar://problem/9516762>. llvm-svn: 132452
* Add c-index-test printing and tests for static and virtual methodDouglas Gregor2011-05-133-25/+25
| | | | | | query functions, from Erik Verbruggen! llvm-svn: 131295
* Introduce a new libclang parsing flag,Douglas Gregor2011-05-061-0/+20
| | | | | | | | | | | | | CXTranslationUnit_NestedMacroInstantiations, which indicates whether we want to see "nested" macro instantiations (e.g., those that occur inside other macro instantiations) within the detailed preprocessing record. Many clients (e.g., those that only care about visible tokens) don't care about this information, and in code that uses preprocessor metaprogramming, this information can have a very high cost. Addresses <rdar://problem/9389320>. llvm-svn: 130990
* When providing code completions for an Objective-C property access,Douglas Gregor2011-05-051-0/+17
| | | | | | | also include methods with zero-argument selectors. Implements <rdar://problem/9048332>. llvm-svn: 130922
* When adding KVC code completions, keep track of all of the selectorsDouglas Gregor2011-05-041-0/+16
| | | | | | | that we've previously seen, both in declared methods and from previous KVC completions, to eliminate duplicates. Fixes <rdar://problem/9162207>. llvm-svn: 130890
* Introduce a new libclang API, clang_isFileMultipleIncludeGuarded(),Douglas Gregor2011-05-043-2/+15
| | | | | | | | which determines whether a particular file is actually a header that is intended to be guarded from multiple inclusions within the same translation unit. llvm-svn: 130808
* Use the canonical decl when generating the locations for USRs.Ted Kremenek2011-05-031-0/+22
| | | | llvm-svn: 130748
* Based on the new information in the AST provided by r130628, writeChandler Carruth2011-05-012-11/+11
| | | | | | | | | | | 3 lines of code and improve a bunch of information in the libclang view of the code. Updates the two tests that exercise this with the new data, checking that each new source location actually points back to the declared template parameter. llvm-svn: 130656
* Don't waste memory if the initializer expression is empty.Argyrios Kyrtzidis2011-04-281-0/+2
| | | | llvm-svn: 130420
* Fixes an instance method meta-data generation bug inFariborz Jahanian2011-04-221-1/+1
| | | | | | | | | | | ObjC NeXt runtime where method pointer registered in metadata belongs to an unrelated method. Ast part of this fix, I turned at @end missing warning (for class implementations) into an error as we can never be sure that meta-data being generated is correct. // rdar://9072317 llvm-svn: 130019
* ForArgyrios Kyrtzidis2011-04-211-0/+14
| | | | | | | | | | | | | | double data[20000000] = {0}; we would blow out the memory by creating 20M Exprs to fill out the initializer. To fix this, if the initializer list initializes an array with more elements than there are initializers in the list, have InitListExpr store a single 'ArrayFiller' expression that specifies an expression to be used for value initialization of the rest of the elements. Fixes rdar://9275920. llvm-svn: 129896
* When translating a Clang source range into a libclang source range,Douglas Gregor2011-04-201-1/+9
| | | | | | | | adjust the a ending macro location to the end of the instantiation location before adjusting it to the end of the token. Fixes <rdar://problem/9021561>. llvm-svn: 129872
* When providing code completions of ivar names for a propertyDouglas Gregor2011-04-181-2/+23
| | | | | | | | | | | | | | | | implementation such as @synthesize Prop1 = Give priority to ivars whose type matches or closely matches the property type (as we do for several other kinds of results). Additionally, if there is an ivar with the same name as the property, or differs only due to a _ prefix or suffix, give that ivar a priority bump. Finally, verify that this search is properly returning ivars within class extensions and implementations (<rdar://problem/8488854>). llvm-svn: 129699
* When producing code completion results for the Objective-C propertyDouglas Gregor2011-04-181-2/+4
| | | | | | | | | | | implementation @synthesize <property> = also produce a completion for a to-be-synthesized ivar named _<property>. llvm-svn: 129697
* When determining the "usage" type of a declaration for the purposes of code Douglas Gregor2011-04-141-0/+12
| | | | | | | completion, look through block pointer and function pointer types to the result type of the block/function. Fixes <rdar://problem/9282583>. llvm-svn: 129535
* Apply a bug-fix patch from Marcin Kowalczyk to the source locations forChandler Carruth2011-04-021-1/+88
| | | | | | | | | | | a couple of operator overloads which form interesting expressions in the AST. I added test cases for both bugs with the c-index-test's token annotation feature. Also, thanks to John McCall for confirming that this is the correct solution. llvm-svn: 128768
* For Diagnostic::Reset() also reset the state related to #pragma diagnostic. ↵Argyrios Kyrtzidis2011-03-261-0/+13
| | | | | | Fixes rdar://9170766. llvm-svn: 128346
* When libclang visits a translation unit via clang_visitChildren(),Douglas Gregor2011-03-161-1/+1
| | | | | | | | | | | | | walk the preprocessing record *before* walking the declarations, so they we pretend that we actually respect the phases of translation. We still walk the preprocessing record after the declarations when performing token annotation or finding the cursor at a location, since those routines depend on those semantics. Fixes <rdar://problem/9137195>. llvm-svn: 127776
* Use ElaboratedType also for C.Abramo Bagnara2011-03-163-9/+9
| | | | llvm-svn: 127755
* c-index-test shouldn't crash when a goto has no matching label. Fixes ↵Ted Kremenek2011-03-151-1/+8
| | | | | | <rdar://problem/9123493>. llvm-svn: 127711
* Fixed type and declaration source range in presence of typeQuals.Abramo Bagnara2011-03-121-1/+1
| | | | llvm-svn: 127535
* Teach libclang's token-annotation logic about context-sensitiveDouglas Gregor2011-03-082-15/+58
| | | | | | keywords for Objective-C+ and C++0x. llvm-svn: 127253
* Fixed source range for StaticAssertDecl and LinkageSpecDecl. Fixed source ↵Abramo Bagnara2011-03-083-6/+6
| | | | | | range for declarations using postfix types. llvm-svn: 127251
* Fixed NamespaceDecl source range.Abramo Bagnara2011-03-083-16/+16
| | | | llvm-svn: 127242
* Fixed source range for all DeclaratorDecl's.Abramo Bagnara2011-03-0820-123/+123
| | | | llvm-svn: 127225
* Fixed TypedefDecl and TemplateTypeParameter source range.Abramo Bagnara2011-03-069-43/+43
| | | | llvm-svn: 127119
* Fixed source range for ClassTemplateSpecializationDecl.Abramo Bagnara2011-03-041-3/+3
| | | | llvm-svn: 126999
* Improved TemplateTypeParmDecl end location.Abramo Bagnara2011-03-042-5/+5
| | | | llvm-svn: 126996
* Fixed end location of NonTypeTemplateParamDecl.Abramo Bagnara2011-03-041-1/+1
| | | | llvm-svn: 126994
* Finish updated testDouglas Gregor2011-03-031-2/+2
| | | | llvm-svn: 126948
* Eliminate redundant nested-name-specifiers onDouglas Gregor2011-03-031-2/+2
| | | | | | TemplateSpecializationTypes, which also fixes PR9388. llvm-svn: 126946
* Fixed end source location for LinkageSpecDecl.Abramo Bagnara2011-03-031-1/+1
| | | | llvm-svn: 126943
* Force CaseStmt to store its child statements in source-code order,Douglas Gregor2011-03-021-3/+43
| | | | | | | which is important for libclang's token-annotation and where's-my-cursor functionality. Fixes <rdar://problem/9004439>. llvm-svn: 126887
* Fix the source range for a member access expression that includes aDouglas Gregor2011-03-021-1/+16
| | | | | | | nested-name-specifier and improve the detection of implicit 'this' bases. Fixes <rdar://problem/8750392>. llvm-svn: 126880
* Teach libclang how to visit the children of a C++ base-class specifierDouglas Gregor2011-03-021-1/+12
| | | | | | (i.e., the TypeLoc describing the base class type). llvm-svn: 126861
* Push nested-name-specifier source location information into templateDouglas Gregor2011-03-021-1/+35
| | | | | | | | | | | | template arguments. I believe that this is the last place in the AST where we were storing a source range for a nested-name-specifier rather than a proper nested-name-specifier location structure. (Yay!) There is still a lot of cleanup to do in the TreeTransform, which doesn't take advantage of nested-name-specifiers with source-location information everywhere it could. llvm-svn: 126844
* Push nested-name-specifier source-location information into dependentDouglas Gregor2011-03-022-178/+217
| | | | | | | | | | | | | | | | | | | | | | | | template specialization types. This also required some parser tweaks, since we were losing track of the nested-name-specifier's source location information in several places in the parser. Other notable changes this required: - Sema::ActOnTagTemplateIdType now type-checks and forms the appropriate type nodes (+ source-location information) for an elaborated-type-specifier ending in a template-id. Previously, we used a combination of ActOnTemplateIdType and ActOnTagTemplateIdType that resulted in an ElaboratedType wrapped around a DependentTemplateSpecializationType, which duplicated the keyword ("class", "struct", etc.) and nested-name-specifier storage. - Sema::ActOnTemplateIdType now gets a nested-name-specifier, which it places into the returned type-source location information. - Sema::ActOnDependentTag now creates types with source-location information. llvm-svn: 126808
* Push nested-name-specifier source-location information into dependentDouglas Gregor2011-03-011-1/+45
| | | | | | | | template specialization types. There are still a few rough edges to clean up with some of the parser actions dropping nested-name-specifiers too early. llvm-svn: 126776
OpenPOWER on IntegriCloud