summaryrefslogtreecommitdiffstats
path: root/include/clang/Sema/CodeCompleteConsumer.h
Commit message (Collapse)AuthorAgeFilesLines
* [code-complete] Introduce CodeCompletionTUInfo which will be used for cachingArgyrios Kyrtzidis2012-04-101-16/+53
| | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154408 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a new libclang API to determine the parent context of a codeDouglas Gregor2012-03-271-14/+61
| | | | | | | | | | 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>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153545 91177308-0d34-0410-b5e6-96231b3b80d8
* Move CodeCompletionBuilder's chunk adding methods out of line.Benjamin Kramer2012-03-261-23/+9
| | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153446 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert my patches which removed Diagnostic.h includes by moving some ↵Benjamin Kramer2012-02-071-1/+0
| | | | | | | | | | | | | | | | | | operator overloads out of line. This seems to negatively affect compile time onsome ObjC tests (which use a lot of partial diagnostics I assume). I have to come up with a way to keep them inline without including Diagnostic.h everywhere. Now adding a new diagnostic requires a full rebuild of e.g. the static analyzer which doesn't even use those diagnostics. This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99. This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789. This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7. This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f. This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150006 91177308-0d34-0410-b5e6-96231b3b80d8
* Move various diagnostic operator<< overloads out of line and remove includes ↵Benjamin Kramer2012-02-041-0/+1
| | | | | | | | | of Diagnostic.h. Fix all the files that depended on transitive includes of Diagnostic.h. With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149781 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a CodeCompletionResult::CreateCodeCompletionString() thatArgyrios Kyrtzidis2012-01-171-0/+3
| | | | | | | | does not depend on Sema, it accepts an ASTContext and a Preprocessor. Step towards making clang_getCursorCompletionString not depend on Sema. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148278 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing 80 col violations (& removing any trailing whitespace on files I was ↵David Blaikie2011-11-091-160/+160
| | | | | | touching anyway) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144171 91177308-0d34-0410-b5e6-96231b3b80d8
* Code completion chunks are pod-like.Benjamin Kramer2011-10-171-1/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142252 91177308-0d34-0410-b5e6-96231b3b80d8
* Added clang_getCompletionAnnotation and clang_getCompletionNumAnnotations toErik Verbruggen2011-10-141-4/+18
| | | | | | | retrieve annotations from completion string. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141953 91177308-0d34-0410-b5e6-96231b3b80d8
* Added CXAvailability_NotAccessible to indicate that a declaration is ↵Erik Verbruggen2011-10-061-3/+4
| | | | | | available, but not accessible from the current code completion context. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141278 91177308-0d34-0410-b5e6-96231b3b80d8
* When performing code completion after at @interface, allow bothDouglas Gregor2011-07-301-2/+2
| | | | | | | | | already-defined and forward-declared results. Already-defined results are fine because they could be the start of a category. Fixes <rdar://problem/9811691>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136559 91177308-0d34-0410-b5e6-96231b3b80d8
* Add new libclang API, clang_codeCompleteGetObjCSelector(), whichDouglas Gregor2011-07-261-2/+19
| | | | | | | | provides the partial Objective-C selector used in a code completion. From Connor Wakamo! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136084 91177308-0d34-0410-b5e6-96231b3b80d8
* New libclang API to expose container type for code completion, fromDouglas Gregor2011-07-211-1/+2
| | | | | | | Connor Wakamo! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135651 91177308-0d34-0410-b5e6-96231b3b80d8
* remove some now-redundant forward declarations.Chris Lattner2011-07-201-5/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135578 91177308-0d34-0410-b5e6-96231b3b80d8
* add raw_ostream and Twine to LLVM.h, eliminating a ton of llvm:: qualifications.Chris Lattner2011-07-201-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135577 91177308-0d34-0410-b5e6-96231b3b80d8
* now that we have a centralized place to do so, add some using declarations forChris Lattner2011-07-201-5/+5
| | | | | | | | some common llvm types: stringref and smallvector. This cleans up the codebase quite a bit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135576 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a new libclang aPI function,Douglas Gregor2011-07-071-3/+27
| | | | | | | | | | 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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134615 91177308-0d34-0410-b5e6-96231b3b80d8
* When providing code completions for an Objective-C property access,Douglas Gregor2011-05-051-1/+4
| | | | | | | | also include methods with zero-argument selectors. Implements <rdar://problem/9048332>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130922 91177308-0d34-0410-b5e6-96231b3b80d8
* When code-completing a case statement for a switch on a value ofDouglas Gregor2011-02-181-0/+6
| | | | | | | | enumeration type, prioritize the enumeration constants and don't provide completions for any other expressions. Fixes <rdar://problem/7283668>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125991 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement code completion results for the Objective-C Key-Value CodingDouglas Gregor2011-02-171-9/+21
| | | | | | | (KVC) and Key-Value Observing (KVO) protocols. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125696 91177308-0d34-0410-b5e6-96231b3b80d8
* When code-completing within a list of declaration specifiers,Douglas Gregor2011-02-151-1/+1
| | | | | | | | | separately handle the case of a local declaration-specifier list, including all types in the set of options. Fixes <rdar://problem/8790735> and <rdar://problem/8662831>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125594 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix Microsoft bit field problem. This resolves the Index\complete-exprs.c ↵Francois Pichet2011-02-031-1/+1
| | | | | | regression on Win32. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124767 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r124704, which uniqued code-completion strings. The spaceDouglas Gregor2011-02-021-38/+0
| | | | | | | | | | savings of 25% sounds impressive, except that this amounted to only about 360k in our standard "large" completion result set (40,000 results). Since code completion is performance-sensitive, the 4% slowdown due to uniquing outweighs the 360k benefit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124737 91177308-0d34-0410-b5e6-96231b3b80d8
* Unique code-completion strings. On Cocoa.h, this costs us about 4% inDouglas Gregor2011-02-011-0/+38
| | | | | | | speed but saves us about 25% of the memory usage for strings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124704 91177308-0d34-0410-b5e6-96231b3b80d8
* Create a special allocator class for code completion, so that all ofDouglas Gregor2011-02-011-9/+16
| | | | | | | | the string copying goes through a single place that can have associated state. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124698 91177308-0d34-0410-b5e6-96231b3b80d8
* Allocate CodeCompletionString and all of its components in aDouglas Gregor2011-02-011-61/+96
| | | | | | | | | | | | | BumpPtrAllocator, rather than manually new/delete'ing them. This optimization also allows us to avoid allocating memory for and copying constant strings (e.g., "return", "class"). This also required embedding the priority and availability of results within the code completion string, to avoid extra memory allocation within libclang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124673 91177308-0d34-0410-b5e6-96231b3b80d8
* Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin2010-12-231-1/+1
| | | | | | | | | | | new gcc warning that complains on self-assignments and self-initializations. Fix one bug found by the warning, in which one clang::OverloadCandidate constructor failed to initialize its FunctionTemplate member. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122459 91177308-0d34-0410-b5e6-96231b3b80d8
* Tweak code-completion result priorities, so that exact and similarDouglas Gregor2010-10-191-5/+5
| | | | | | | | | | type matches have a bigger impact. The impetus for this change was that, when initializing an enumeration value, we want enumerators of that enumeration type to have a higher priority than, e.g., unrelated local variables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116774 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate the (de-)serialization of code completion results, now thatDouglas Gregor2010-10-111-34/+0
| | | | | | | libclang does not support out-of-process code completion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116253 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch c-index-test from clang_codeComplete() over toDouglas Gregor2010-10-111-1/+2
| | | | | | | | | | | | clang_codeCompleteAt(). This uncovered a few issues with the latter: - ASTUnit wasn't saving/restoring diagnostic state appropriately between reparses and code completions. - "Overload" completions weren't being passed through to the client git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116241 91177308-0d34-0410-b5e6-96231b3b80d8
* Synchronize globally-cached code completion results with the resultsDouglas Gregor2010-09-231-2/+5
| | | | | | | | | | | | | | | provided when the optimization is disabled. In particular, split the completion context CCC_Other into two contexts: CCC_Other, which means that it's an undisclosed context for which any other results are unwelcome, and CCC_Recovery, which is used in recovery cases. Since we're now using the completion context within the completion results builder, make sure that it's always set to something. Fixes <rdar://problem/8470644>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114704 91177308-0d34-0410-b5e6-96231b3b80d8
* Add code completion for C++ constructors wherever we see the class (orDouglas Gregor2010-09-211-0/+4
| | | | | | | class template) and are in a context where we can have a value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114441 91177308-0d34-0410-b5e6-96231b3b80d8
* Code completion has no reason to prefer values over types, especiallyDouglas Gregor2010-09-201-2/+2
| | | | | | | | | at the statement level or in Objective-C message receivers. Therefore, just give types and declarations the same basic priority, and adjust from there. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114374 91177308-0d34-0410-b5e6-96231b3b80d8
* Get rid of the lame attempt to prioritize "void" functions atDouglas Gregor2010-09-201-5/+0
| | | | | | | | statement context; it really isn't helpful in practice (remember printf!) and we'll be doing other adjustments for statements very soon. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114358 91177308-0d34-0410-b5e6-96231b3b80d8
* Tweak priorities for some types and macros:Douglas Gregor2010-09-201-1/+8
| | | | | | | | | | | | - In Objective-C, we prefer BOOL to bool for historic reasons; slightly penalize "bool". - Treat Nil macro as a NULL pointer constant. - Treat YES, NO, true, and false macros as constants. - Treat the bool macro as a type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114356 91177308-0d34-0410-b5e6-96231b3b80d8
* Give the Objective-C _cmd an "unlikely" code completion priority; it'sDouglas Gregor2010-09-181-1/+4
| | | | | | | very rarely used. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114286 91177308-0d34-0410-b5e6-96231b3b80d8
* Swap the priorities of constants and types, so that we prefer types.Douglas Gregor2010-09-161-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114086 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a new code-completion context for a parenthesizedDouglas Gregor2010-09-141-1/+4
| | | | | | | | | expression, e.g., after the '(' that could also be a type cast. Here, we provide types as code-completion results in C/Objective-C (C++ already had them), although we wouldn't in a normal expression context. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113904 91177308-0d34-0410-b5e6-96231b3b80d8
* Synchronize code-completion cursor kinds with indexing cursorDouglas Gregor2010-09-031-0/+6
| | | | | | | kinds. How shameful that this code was duplicated! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113033 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve code completion for initializer lists in constructors. InsteadDouglas Gregor2010-08-291-0/+3
| | | | | | | | | | | | of prioritizing just by initialization order, we bump the priority of just the *next* initializer in the list, and leave everything else at the normal priority. That way, if one intentionally skips the initialization of a base or member (to get default initialization), we'll still get ordered completion for the rest. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112454 91177308-0d34-0410-b5e6-96231b3b80d8
* Suggest "const" and "volatile" code completions after a functionDouglas Gregor2010-08-271-1/+3
| | | | | | | declarator, the very definition of "low-hanging fruit". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112274 91177308-0d34-0410-b5e6-96231b3b80d8
* When code-completing inside an Objective-C method, give a slightDouglas Gregor2010-08-271-1/+5
| | | | | | | priority boost to methods with the same selector. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112268 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a super-cool code completion for send-to-super. When we're typingDouglas Gregor2010-08-271-0/+2
| | | | | | | | | | a message send to "super" from a method that appears to be meant to override a superclass method (same kind, same selector, same argument types), provide a "super" completion that fills in the selector along with forwarding the method's arguments (as placeholders). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112263 91177308-0d34-0410-b5e6-96231b3b80d8
* When code-completing a potential call to a C++ non-static memberDouglas Gregor2010-08-261-2/+5
| | | | | | | | | | function, take into account the qualifiers on the object argument (e.g., what will become "this"), filtering around uncallable member functions and giving a slight priority boost to those with exactly-matching qualifiers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112193 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement code completion for @selector expressionsDouglas Gregor2010-08-261-1/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112186 91177308-0d34-0410-b5e6-96231b3b80d8
* When combining the code-completion results from Sema long with theDouglas Gregor2010-08-251-0/+21
| | | | | | | | | code-completion results cached by ASTUnit, sort the resulting result set. This makes testing far, far easier, so this commit also includes tests for the previous few fixes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112070 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a code-completion context for "natural language" completions, soDouglas Gregor2010-08-251-1/+7
| | | | | | | that ASTUnit knows not to try to provide completions there. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112057 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach Sema to live without CodeCompleteConsumer.h.John McCall2010-08-251-147/+149
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112028 91177308-0d34-0410-b5e6-96231b3b80d8
* Give a slight preference to functions returning "void" when we'reDouglas Gregor2010-08-241-1/+6
| | | | | | | | performing code completion at the statement level (rather than in an arbitrary expression). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112001 91177308-0d34-0410-b5e6-96231b3b80d8
* In code-completion contexts where both types and other values areDouglas Gregor2010-08-241-2/+2
| | | | | | | | | | | present, prefer values to types, since it's more common to compute with values than it is to declare new entities or perform type casts. So, tweak the ranking of types vs. other declarations and constants accordingly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111998 91177308-0d34-0410-b5e6-96231b3b80d8