summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCodeComplete.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [libclang] For "@import .." code-completion results, associate a ↵Argyrios Kyrtzidis2013-05-291-2/+2
| | | | | | CXCursor_ModuleImportDecl cursor instead of CXCursor_NotImplemented. llvm-svn: 182871
* Enhance the ObjC global method pool to record whether there were 0, 1, or >= ↵Argyrios Kyrtzidis2013-04-171-3/+3
| | | | | | | | | 2 methods (with a particular selector) inside categories. This is done by extending ObjCMethodList (which is only used by the global method pool) to have 2 extra bits of information. We will later take advantage of this info in global method pool for the overridden methods calculation. llvm-svn: 179652
* Parsing support for thread_local and _Thread_local. We give them the sameRichard Smith2013-04-121-4/+3
| | | | | | semantics as __thread for now. llvm-svn: 179424
* Add 178663 back.Rafael Espindola2013-04-031-1/+1
| | | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. llvm-svn: 178682
* Revert 178663.Rafael Espindola2013-04-031-1/+1
| | | | | | | | | | Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb Revert "Don't compute a patched/semantic storage class." This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05. llvm-svn: 178681
* Don't compute a patched/semantic storage class.Rafael Espindola2013-04-031-1/+1
| | | | | | | | | | | For variables and functions clang used to store two storage classes. The one "as written" in the code and a patched one, which, for example, propagates static to the following decls. This apparently is from the days clang lacked linkage computation. It is now redundant and this patch removes it. llvm-svn: 178663
* Support C11 _Atomic type qualifier. This is more-or-less just syntactic ↵Richard Smith2013-03-281-0/+3
| | | | | | sugar for the _Atomic type specifier. llvm-svn: 178210
* [Preprocessor/Modules] Separate the macro directives kinds into their own ↵Argyrios Kyrtzidis2013-03-261-1/+1
| | | | | | | | | | | | | | | | MacroDirective's subclasses. For each macro directive (define, undefine, visibility) have a separate object that gets chained to the macro directive history. This has several benefits: -No need to mutate a MacroDirective when there is a undefine/visibility directive. Stuff like PPMutationListener become unnecessary. -No need to keep extra source locations for the undef/visibility locations for the define directive object (which is the majority of the directives) -Much easier to hide/unhide a section in the macro directive history. -Easier to track the effects of the directives across different submodules. llvm-svn: 178037
* documentation parsing: when providing code completion commentFariborz Jahanian2013-03-231-2/+9
| | | | | | | for a getter used in property-dot syntax, if geter has its own comment use it. // rdar://12791315 llvm-svn: 177797
* documentation parsing. Provide code completion comment Fariborz Jahanian2013-03-221-0/+14
| | | | | | | | for self.GetterName where GetterName is the getter method for a property with name different from the property name (declared via a property getter attribute) // rdar://12791315 llvm-svn: 177744
* Don't try to typo-correct 'super' in an objc method.Argyrios Kyrtzidis2013-03-141-1/+1
| | | | | | | | | | | | | | | | | | | | | This created 2 issues: 1) Performance issue, since typo-correction with PCH/modules is rather expensive. 2) Correctness issue, since if it managed to "correct" 'super' then bogus compiler errors would be emitted, like this: 3.m:8:3: error: unknown type name 'super'; did you mean 'super1'? super.x = 0; ^~~~~ super1 t3.m:5:13: note: 'super1' declared here typedef int super1; ^ t3.m:8:8: error: expected identifier or '(' super.x = 0; ^ llvm-svn: 177126
* Add TagDecl::hasNameForLinkage(), which is true if the tagJohn McCall2013-03-091-1/+1
| | | | | | is non-anonymous or is defined in a typedef of itself. llvm-svn: 176742
* Add code completion for @import <rdar://problem/13344306>.Douglas Gregor2013-03-071-0/+8
| | | | llvm-svn: 176666
* objective-C code completion. Property accessors may notFariborz Jahanian2013-02-281-1/+6
| | | | | | | | have their own code completion comments. Use those in their properties in this case. // rdar://12791315 llvm-svn: 176271
* [preprocessor] Split the MacroInfo class into two separate concepts, ↵Argyrios Kyrtzidis2013-02-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | MacroInfo class for the data specific to a macro definition (e.g. what the tokens are), and MacroDirective class which encapsulates the changes to the "macro namespace" (e.g. the location where the macro name became active, the location where it was undefined, etc.) (A MacroDirective always points to a MacroInfo object.) Usually a macro definition (MacroInfo) is where a macro name becomes active (MacroDirective) but splitting the concepts allows us to better model the effect of modules to the macro namespace (also as a bonus it allows better modeling of push_macro/pop_macro #pragmas). Modules can have their own macro history, separate from the local (current translation unit) macro history; MacroDirectives will be used to model the macro history (changes to macro namespace). For example, if "@import A;" imports macro FOO, there will be a new local MacroDirective created to indicate that "FOO" became active at the import location. Module "A" itself will contain another MacroDirective in its macro history (at the point of the definition of FOO) and both MacroDirectives will point to the same MacroInfo object. Introducing the separation of macro concepts is the first part towards better modeling of module macros. llvm-svn: 175585
* Replace TypeLoc llvm::cast support to be well-defined.David Blaikie2013-02-181-18/+17
| | | | | | | | | | | | | | The TypeLoc hierarchy used the llvm::cast machinery to perform undefined behavior by casting pointers/references to TypeLoc objects to derived types and then using the derived copy constructors (or even returning pointers to derived types that actually point to the original TypeLoc object). Some context is in this thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html Though it's spread over a few months which can be hard to read in the mail archive. llvm-svn: 175462
* Remove a const_cast by propagating constness to called functionsDmitri Gribenko2013-02-141-2/+2
| | | | llvm-svn: 175161
* Remove some stray uses of <ctype.h> functions.Jordan Rose2013-02-091-1/+2
| | | | | | These are causing assertions on some MSVC builds. llvm-svn: 174805
* When code completing in a statement, parenthesized expression, orDouglas Gregor2013-01-311-1/+9
| | | | | | | | Objective-C message receiver, the user is as likely to want to write a type name as any other declaration, so give types the same priority as other declarations. Fixes <rdar://problem/12480600>. llvm-svn: 174038
* Allow the computation of the base priority for a declaration code completion ↵Douglas Gregor2013-01-311-19/+65
| | | | | | result to consider the completion context llvm-svn: 174037
* Add "instancetype" as a code completion result for the return type ofDouglas Gregor2013-01-301-0/+5
| | | | | | an Objective-C method. Fixes <rdar://problem/13069990>. llvm-svn: 173905
* The instance methods of the root class of an Objective-C hieararchyDouglas Gregor2013-01-301-2/+6
| | | | | | | can be messaged via the metaclass. Provide code completions for this case. Fixes <rdar://problem/12560296>. llvm-svn: 173903
* Use 'const Decl *' throughout code completion in SemaDmitri Gribenko2013-01-231-116/+125
| | | | llvm-svn: 173277
* Rework the traversal of Objective-C categories and extensions toDouglas Gregor2013-01-161-27/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | consider (sub)module visibility. The bulk of this change replaces myriad hand-rolled loops over the linked list of Objective-C categories/extensions attached to an interface declaration with loops using one of the four new category iterator kinds: visible_categories_iterator: Iterates over all visible categories and extensions, hiding any that have their "hidden" bit set. This is by far the most commonly used iterator. known_categories_iterator: Iterates over all categories and extensions, ignoring the "hidden" bit. This tends to be used for redeclaration-like traversals. visible_extensions_iterator: Iterates over all visible extensions, hiding any that have their "hidden" bit set. known_extensions_iterator: Iterates over all extensions, whether they are visible to normal name lookup or not. The effect of this change is that any uses of the visible_ iterators will respect module-import visibility. See the new tests for examples. Note that the old accessors for categories and extensions are gone; there are *Raw() forms for some of them, for those (few) areas of the compiler that have to manipulate the linked list of categories directly. This is generally discouraged. Part two of <rdar://problem/10634711>. llvm-svn: 172665
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Constify parameter of clang::getCursorKindForDeclDmitri Gribenko2013-01-111-2/+2
| | | | llvm-svn: 172249
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-5/+5
| | | | llvm-svn: 171367
* Revert r170500. It over-zealously converted *ALL* things named Attributes, ↵Bill Wendling2012-12-201-19/+19
| | | | | | which is wrong here. llvm-svn: 170721
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-191-19/+19
| | | | | | single attribute in the future. llvm-svn: 170500
* Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as ↵David Blaikie2012-12-191-3/+4
| | | | | | | | | | | | | | | per review discussion in r170365 This does limit these typedefs to being sequences, but no current usage requires them to be contiguous (we could expand this to a more general iterator pair range concept at some point). Also, it'd be nice if SmallVector were constructible directly from an ArrayRef but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the inverse conversion. (& generalizing over all range-like things, while nice, would require some nontrivial SFINAE I haven't thought about yet) llvm-svn: 170482
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-6/+6
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* From Vassil Vassilev: enable Sema to deal with multiple ExternalSemaSources.Axel Naumann2012-10-181-3/+3
| | | | llvm-svn: 166208
* If a macro has been #undef'd in a precompiled header, we still need toDouglas Gregor2012-10-091-14/+12
| | | | | | | | | | | | write out the macro history for that macro. Similarly, we need to cope with reading a macro definition that has been #undef'd. Take advantage of this new ability so that global code-completion results can refer to #undef'd macros, rather than losing them entirely. For multiply defined/#undef'd macros, we will still get the wrong result, but it's better than getting no result. llvm-svn: 165502
* [libclang] Introduce CXCursor_ModuleImportDecl cursor kind, used for a moduleArgyrios Kyrtzidis2012-10-051-0/+3
| | | | | | import declaration. llvm-svn: 165277
* [libclang] Always report a CXCursor_MacroDefinition for code-completionArgyrios Kyrtzidis2012-09-271-1/+3
| | | | | | results for a macro name, not CXCursor_NotImplemented. llvm-svn: 164740
* [libclang] Remove the ParentKind cursor kind from code-completion results.Argyrios Kyrtzidis2012-09-261-1/+0
| | | | | | This is to reduce dependency to cursors for the code-completion results. llvm-svn: 164705
* Remove unused typedefs. Found by gcc48.Roman Divacky2012-09-061-12/+0
| | | | llvm-svn: 163327
* Improved MSVC __interface support by adding first class support for it, ↵Joao Matos2012-08-311-4/+9
| | | | | | instead of aliasing to "struct" which had some incorrect behaviour. Patch by David Robins. llvm-svn: 163013
* Keep history of macro definitions and #undefsAlexander Kornienko2012-08-291-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Summary: Keep history of macro definitions and #undefs with corresponding source locations, so that we can later find out all macros active in a specified source location. We don't save the history in PCH (no need currently). Memory overhead is about sizeof(void*)*3*<number of macro definitions and #undefs>+<in-memory size of all #undef'd macros> I've run a test on a file composed of 109 .h files from boost 1.49 on x86-64 linux. Stats before this patch: *** Preprocessor Stats: 73222 directives found: 19171 #define. 4345 #undef. #include/#include_next/#import: 5233 source files entered. 27 max include stack depth 19210 #if/#ifndef/#ifdef. 2384 #else/#elif. 6891 #endif. 408 #pragma. 14466 #if/#ifndef#ifdef regions skipped 80023/451669/1270 obj/fn/builtin macros expanded, 85724 on the fast path. 127145 token paste (##) operations performed, 11008 on the fast path. Preprocessor Memory: 5874615B total BumpPtr: 4399104 Macro Expanded Tokens: 417768 Predefines Buffer: 8135 Macros: 1048576 #pragma push_macro Info: 0 Poison Reasons: 1024 Comment Handlers: 8 Stats with this patch: ... Preprocessor Memory: 7541687B total BumpPtr: 6066176 Macro Expanded Tokens: 417768 Predefines Buffer: 8135 Macros: 1048576 #pragma push_macro Info: 0 Poison Reasons: 1024 Comment Handlers: 8 In my test increase in memory usage is about 1.7Mb, which is ~28% of initial preprocessor's memory usage and about 0.8% of clang's total VMM allocation. As for CPU overhead, it should only be noticeable when iterating over all macros, and should mostly consist of couple extra dereferences and one comparison per macro + skipping of #undef'd macros. It's less trivial to measure, though, as the preprocessor consumes a very small fraction of compilation time. Reviewers: doug.gregor, klimek, rsmith, djasper Reviewed By: doug.gregor CC: cfe-commits, chandlerc Differential Revision: http://llvm-reviews.chandlerc.com/D28 llvm-svn: 162810
* Fix a bunch of -Wdocumentation warnings.Dmitri Gribenko2012-08-231-1/+1
| | | | llvm-svn: 162452
* Screw around with ObjCRuntime some more, changing theJohn McCall2012-08-211-2/+1
| | | | | | | | diagnostics for bad deployment targets and adding a few more predicates. Includes a patch by Jonathan Schleifer to enable ARC for ObjFW. llvm-svn: 162252
* Code-complete 'weak' for properties under ARC-with-weak-references (or GC)Jordan Rose2012-08-201-10/+14
| | | | | | | | | | Also, suggest 'readonly' even if the property has been given an ownership attribute ('strong', 'weak', etc). This is used when properties are declared readonly in the public interface but readwrite in a class extension. <rdar://problem/11500004&11932285> llvm-svn: 162220
* Make the spacing of the code completion result for NSDictionaryDouglas Gregor2012-08-171-1/+0
| | | | | | | literals match the spacing introduced by the ObjC modernizer. Fixes the rest of <rdar://problem/11889572>. llvm-svn: 162084
* Attaching comments to declarations: find comment attached to any redeclarationDmitri Gribenko2012-08-111-1/+1
| | | | | | | | Not only look for the comment near the declaration itself, but also walk the redeclaration chain: the previous declaration might have had a documentation comment. llvm-svn: 161722
* Provide isConst/Volatile on CXXMethodDecl.David Blaikie2012-08-101-3/+3
| | | | | | | | | This also provides isConst/Volatile/Restrict on FunctionTypes to coalesce the implementation with other callers (& update those other callers). Patch contributed by Sam Panzer (panzer@google.com). llvm-svn: 161647
* Remove unnecessary spacing around Objective-C object literal codeDouglas Gregor2012-07-171-9/+3
| | | | | | completions. Fixes <rdar://problem/11889572>. llvm-svn: 160407
* Add a new libclang completion API to get brief documentation comment that isDmitri Gribenko2012-07-021-4/+14
| | | | | | | | | | | | | | | | attached to a declaration in the completion string. Since extracting comments isn't free, a new code completion option is introduced. A new code completion option that enables including brief comments into CodeCompletionString should be a, err, code completion option. But because ASTUnit caches global declarations during parsing before even completion consumer is created, the option is duplicated as a translation unit option (in both libclang and ASTUnit, like the option to cache code completion results). llvm-svn: 159539
* Add support for the C11 _Alignof keyword.Jordan Rose2012-06-301-0/+13
| | | | | | | This behaves like the existing GNU __alignof and C++11 alignof keywords; most of the patch is simply adding the third token spelling to various places. llvm-svn: 159494
* Documentation cleanup: fix two typos, rief -> brief and Descripts -> DescribesJames Dennett2012-06-171-2/+2
| | | | llvm-svn: 158630
* [completion] Add completions for @"..." and @(...), and tidy up @[] and @{}.Jordan Rose2012-06-151-2/+20
| | | | | | | | | | | | | Specifically, @[] and @{} didn't have a type associated with them; we now use "NSArray *" and "NSDictionary *", respectively. @"" has the type "NSString *". @(), unfortunately, has type "id", since it (currently) may be either an NSNumber or an NSString. Add a test for all the Objective-C at-expression completions. <rdar://problem/11507708&11507668&11507711> llvm-svn: 158533
OpenPOWER on IntegriCloud