summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCodeComplete.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Still more Doxygen documentation fixes:James Dennett2012-06-141-3/+0
| | | | | | | | * Escape #, < and @ symbols where Doxygen would try to interpret them; * Fix several function param documentation where names had got out of sync; * Delete param documentation referring to parameters that no longer exist. llvm-svn: 158472
* This makes SemaCodeComplete.cpp more Doxygen-friendly by changing theJames Dennett2012-06-141-30/+31
| | | | | | | | | | | | | | | | OBJC_AT_KEYWORD_NAME take a string literal argument where previously its second argument was an unquoted token; macro invocations such as OBJC_AT_KEYWORD_NAME(NeedAt,{) confuse Doxygen's parser. While I'm wary of changing code (rather than just comments) to work around Doxygen's limitations, in this case the change makes the code more readable for human beings as well, and the macro derived no benefit from using the preprocessor's stringification operator, as it never has need of the unquoted token. I've also included a couple of trivial drive-by fixes to doc comments. llvm-svn: 158440
* When code completion walks the members of a protocol or interface,Douglas Gregor2012-06-121-13/+45
| | | | | | make sure that we walk the definition. Fixes <rdar://problem/11427742>. llvm-svn: 158357
* Convert comments to proper Doxygen comments.Dmitri Gribenko2012-06-081-3/+3
| | | | llvm-svn: 158241
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-061-12/+12
| | | | | | | | | | | | | | value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. llvm-svn: 158104
* Make BuiltinType::getName return a StringRef and introduce ↵Argyrios Kyrtzidis2012-05-051-1/+1
| | | | | | | | | | | | | BuiltinType::getNameAsCString to get a const char* if necessary. This avoids unnecessary conversions when we want to use the result of getName as a StringRef. Part of rdar://10796159 llvm-svn: 156227
* clang_getCursorLexicalParent should return a translation unit cursor for ↵Douglas Gregor2012-04-301-0/+1
| | | | | | declarations at the global scope, from Evan P. Fixes PR9083. llvm-svn: 155858
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-16/+16
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* Include the Objective-C parameter- and return-passing qualifiers whenDouglas Gregor2012-04-101-5/+15
| | | | | | | providing code completions for Objective-C method declarations. Fixes <rdar://problem/11164498>. llvm-svn: 154421
* Don't include the ':' following code-completion suggestions forDouglas Gregor2012-04-101-3/+6
| | | | | | | 'public', 'private', or 'protected', unless code completion patterns are enabled. Fixes <rdar://problem/11189132>. llvm-svn: 154413
* [code-complete] Introduce CodeCompletionTUInfo which will be used for cachingArgyrios Kyrtzidis2012-04-101-37/+114
| | | | | | | | | | | | | | | | | | | code-completion related strings specific to a translation unit (ASTContext and related data) CodeCompletionAllocator does such limited caching, by caching the name assigned to a DeclContext*, but that is not the appropriate place since that object has a lifetime that can extend beyond that of an ASTContext. Introduce CodeCompletionTUInfo which will be always tied to a translation unit to do this kind of caching and move the caching of CodeCompletionAllocator into this object, and propagate it to all the places where it will be needed. The plan is to extend the caching where appropriate, using CodeCompletionTUInfo, to avoid re-calculating code-completion strings. Part of rdar://10796159. llvm-svn: 154408
* Remove more redundant lookups. Add a new "all_lookups_iterator" which providesNick Lewycky2012-04-031-9/+1
| | | | | | | | a view over the contents of a DeclContext without exposing the implementation details of the StoredDeclsMap. Use this in LookupVisibleDecls to find the visible declarations. Fixes PR12339! llvm-svn: 153970
* Introduce a new libclang API to determine the parent context of a codeDouglas Gregor2012-03-271-34/+22
| | | | | | | | | completion item. For example, if the code completion itself represents a declaration in a namespace (say, std::vector), then this API retrieves the cursor kind and name of the namespace (std). Implements <rdar://problem/11121951>. llvm-svn: 153545
* Move CodeCompletionBuilder's chunk adding methods out of line.Benjamin Kramer2012-03-261-38/+31
| | | | | | | This makes sense because chunk's ctor is also out of line and simplifies considerably when inlined with a constant parameter. Shrinks clang on i386-linux-Release+Asserts by 65k. llvm-svn: 153446
* [Sema] Prefer to use ObjCInterfaceDecl's protocol_begin()/protocol_end() ↵Argyrios Kyrtzidis2012-03-131-3/+2
| | | | | | | | | iterators instead of ObjCInterfaceDecl::getReferencedProtocols(), because the iterators are safe to use even if the caller did not check that the interface is a definition. llvm-svn: 152597
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-71/+71
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,Ted Kremenek2012-03-061-0/+20
| | | | | | | | | | | | | NSNumber, and boolean literals. This includes both Sema and Codegen support. Included is also support for new Objective-C container subscripting. My apologies for the large patch. It was very difficult to break apart. The patch introduces changes to the driver as well to cause clang to link in additional runtime support when needed to support the new language features. Docs are forthcoming to document the implementation and behavior of these features. llvm-svn: 152137
* ArrayRef'ize various functions in the AST/Parser/Sema.Ahmed Charles2012-02-251-19/+17
| | | | llvm-svn: 151447
OpenPOWER on IntegriCloud