aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/CodeCompleteConsumer.cpp
AgeCommit message (Collapse)AuthorFilesLines
2014-05-26[C++11] Use 'nullptr'. Sema edition.Craig Topper1-5/+5
llvm-svn: 209613
2014-05-03Fix a bunch of mislayered clang/Lex includes from SemaAlp Toker1-1/+0
llvm-svn: 207896
2013-01-31Allow the computation of the base priority for a declaration code completion ↵Douglas Gregor1-28/+0
result to consider the completion context llvm-svn: 174037
2013-01-23Use 'const Decl *' throughout code completion in SemaDmitri Gribenko1-15/+16
llvm-svn: 173277
2013-01-12Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko1-2/+2
brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
2012-12-04Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth1-4/+4
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
2012-09-26[libclang] Remove the ParentKind cursor kind from code-completion results.Argyrios Kyrtzidis1-5/+2
This is to reduce dependency to cursors for the code-completion results. llvm-svn: 164705
2012-07-02Add a new libclang completion API to get brief documentation comment that isDmitri Gribenko1-5/+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
2012-05-20Bitpack CodeCompletionResults.Benjamin Kramer1-7/+1
llvm-svn: 157158
2012-04-10[code-complete] Introduce CodeCompletionTUInfo which will be used for cachingArgyrios Kyrtzidis1-52/+69
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
2012-03-27Introduce a new libclang API to determine the parent context of a codeDouglas Gregor1-9/+80
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
2012-03-26Move CodeCompletionBuilder's chunk adding methods out of line.Benjamin Kramer1-0/+34
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
2012-03-17When determining the availability of an enum constant, also considerDouglas Gregor1-2/+11
the availability of the enumeration type itself. Fixes <rdar://problem/10996386>. llvm-svn: 152977
2012-02-05Basic: import SmallString<> into clang namespaceDylan Noblesmith1-1/+1
(I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
2012-02-04Move a method from IdentifierTable.h out of line and remove the SmallString ↵Benjamin Kramer1-0/+1
include. Fix all the transitive include users. llvm-svn: 149783
2012-01-17Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie1-5/+4
appropriate or when GCC requires it) llvm-svn: 148292
2012-01-01Eliminate ObjCForwardProtocolDecl, which is redundant now thatDouglas Gregor1-2/+5
ObjCProtocolDecl modules forward declarations properly. llvm-svn: 147415
2011-12-27Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDeclDouglas Gregor1-2/+8
covers both declarations (@class) and definitions (@interface) of an Objective-C class. llvm-svn: 147299
2011-10-14Change operator<< for raw_ostream and NamedDecl to take a reference instead ↵Benjamin Kramer1-1/+1
of a pointer. Passing a pointer was a bad idea as it collides with the overload for void*. llvm-svn: 141971
2011-10-14Added clang_getCompletionAnnotation and clang_getCompletionNumAnnotations toErik Verbruggen1-4/+28
retrieve annotations from completion string. llvm-svn: 141953
2011-10-06Added CXAvailability_NotAccessible to indicate that a declaration is ↵Erik Verbruggen1-1/+4
available, but not accessible from the current code completion context. llvm-svn: 141278
2011-07-30When performing code completion after at @interface, allow bothDouglas Gregor1-1/+1
already-defined and forward-declared results. Already-defined results are fine because they could be the start of a category. Fixes <rdar://problem/9811691>. llvm-svn: 136559
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner1-6/+5
LLVM.h imports them into the clang namespace. llvm-svn: 135852
2011-07-07Introduce a new libclang aPI function,Douglas Gregor1-1/+7
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
2011-03-23Implement a new 'availability' attribute, that allows one to specifyDouglas Gregor1-4/+13
which versions of an OS provide a certain facility. For example, void foo() __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6))); says that the function "foo" was introduced in 10.2, deprecated in 10.4, and completely obsoleted in 10.6. This attribute ties in with the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that we want to deploy back to Mac OS X 10.1). There are several concrete behaviors that this attribute enables, as illustrated with the function foo() above: - If we choose a deployment target >= Mac OS X 10.4, uses of "foo" will result in a deprecation warning, as if we had placed attribute((deprecated)) on it (but with a better diagnostic) - If we choose a deployment target >= Mac OS X 10.6, uses of "foo" will result in an "unavailable" warning (in C)/error (in C++), as if we had placed attribute((unavailable)) on it - If we choose a deployment target prior to 10.2, foo() is weak-imported (if it is a kind of entity that can be weak imported), as if we had placed the weak_import attribute on it. Naturally, there can be multiple availability attributes on a declaration, for different platforms; only the current platform matters when checking availability attributes. The only platforms this attribute currently works for are "ios" and "macosx", since we already have -mxxxx-version-min flags for them and we have experience there with macro tricks translating down to the deprecated/unavailable/weak_import attributes. The end goal is to open this up to other platforms, and even extension to other "platforms" that are really libraries (say, through a #pragma clang define_system), but that hasn't yet been designed and we may want to shake out more issues with this narrower problem first. Addresses <rdar://problem/6690412>. As a drive-by bug-fix, if an entity is both deprecated and unavailable, we only emit the "unavailable" diagnostic. llvm-svn: 128127
2011-02-18When code-completing a case statement for a switch on a value ofDouglas Gregor1-0/+1
enumeration type, prioritize the enumeration constants and don't provide completions for any other expressions. Fixes <rdar://problem/7283668>. llvm-svn: 125991
2011-02-17Implement code completion results for the Objective-C Key-Value CodingDouglas Gregor1-0/+9
(KVC) and Key-Value Observing (KVO) protocols. llvm-svn: 125696
2011-02-02Revert r124704, which uniqued code-completion strings. The spaceDouglas Gregor1-31/+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. llvm-svn: 124737
2011-02-01Unique code-completion strings. On Cocoa.h, this costs us about 4% inDouglas Gregor1-0/+31
speed but saves us about 25% of the memory usage for strings. llvm-svn: 124704
2011-02-01Create a special allocator class for code completion, so that all ofDouglas Gregor1-0/+7
the string copying goes through a single place that can have associated state. llvm-svn: 124698
2011-02-01Allocate CodeCompletionString and all of its components in aDouglas Gregor1-106/+31
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. llvm-svn: 124673
2010-10-11Eliminate the (de-)serialization of code completion results, now thatDouglas Gregor1-154/+0
libclang does not support out-of-process code completion. llvm-svn: 116253
2010-09-23Synchronize globally-cached code completion results with the resultsDouglas Gregor1-1/+2
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>. llvm-svn: 114704
2010-09-21Add code completion for C++ constructors wherever we see the class (orDouglas Gregor1-0/+40
class template) and are in a context where we can have a value. llvm-svn: 114441
2010-09-18Give the Objective-C _cmd an "unlikely" code completion priority; it'sDouglas Gregor1-1/+9
very rarely used. llvm-svn: 114286
2010-09-03Synchronize code-completion cursor kinds with indexing cursorDouglas Gregor1-87/+5
kinds. How shameful that this code was duplicated! llvm-svn: 113033
2010-09-03Simplify code-completion result sorting a bitDouglas Gregor1-8/+0
llvm-svn: 112968
2010-08-31Rename DeclContext::getLookupContext to getRedeclContext and change its ↵Sebastian Redl1-1/+1
semantics slightly. No functionality change in the absence of inline namespaces. Also, change a few places where inline namespaces actually make a difference to be prepared for them. llvm-svn: 112563
2010-08-26Move the sorting of code-completion results out of the main path andDouglas Gregor1-1/+8
into the clients, e.g., the printing code-completion consumer and c-index-test. Clients may want to re-sort the results anyway. Provide a libclang function that sorts the results. 3rd try. How embarrassing. llvm-svn: 112180
2010-08-26Revert r112149, "Move the sorting of code-completion results out of the mainDaniel Dunbar1-8/+1
path and ...", it is failing tests. llvm-svn: 112161
2010-08-26Move the sorting of code-completion results out of the main path andDouglas Gregor1-1/+8
into the clients, e.g., the printing code-completion consumer and c-index-test. Clients may want to re-sort the results anyway. Provide a libclang function that sorts the results. llvm-svn: 112149
2010-08-26Revert "Move the sorting of code-completion results out of the main path andDouglas Gregor1-8/+1
into the clients", because the C standard library sucks. Where's my stable sort, huh? llvm-svn: 112121
2010-08-25Move the sorting of code-completion results out of the main path andDouglas Gregor1-1/+8
into the clients, e.g., the printing code-completion consumer and c-index-test. Clients may want to re-sort the results anyway. llvm-svn: 112095
2010-08-25When combining the code-completion results from Sema long with theDouglas Gregor1-0/+56
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. llvm-svn: 112070
2010-08-25Teach Sema to live without CodeCompleteConsumer.h.John McCall1-12/+12
llvm-svn: 112028
2010-08-25Move more stuff out of Sema.h.John McCall1-0/+1
llvm-svn: 112026
2010-08-24Struggle mightily against header inclusion in Sema.h.John McCall1-0/+1
llvm-svn: 111904
2010-08-23Introduce new libclang API functions that determine the availabilityDouglas Gregor1-1/+14
of a cursor or code-completion result, e.g., whether that result refers to an unavailable, deleted, or deprecated declaration. llvm-svn: 111858
2010-08-20Another step in the process of making the parser depend on Sema:John McCall1-1/+1
- move DeclSpec &c into the Sema library - move ParseAST into the Parse library Reflect this change in a thousand different includes. Reflect this change in the link orders. llvm-svn: 111667
2010-08-13Implement caching of code-completion results for macro definitionsDouglas Gregor1-75/+89
when the CXTranslationUnit_CacheCompletionResults option is given to clang_parseTranslationUnit(). Essentially, we compute code-completion results for macro definitions after we have parsed the file, then store an ASTContext-agnostic version of those results (completion string, cursor kind, priority, and active contexts) in the ASTUnit. When performing code completion in that ASTUnit, we splice the macro definition results into the results provided by the actual code-completion (which has had macros turned off) before libclang gets those results. We use completion context information to only splice in those results that make sense for that context. With a completion involving all of the macros from Cocoa.h and a few other system libraries (totally ~8500 macro definitions) living in a precompiled header, we get about a 9% performance improvement from code completion, since we no longer have to deserialize all of the macro definitions from the precompiled header. Note that macro definitions are merely the canary; the cache is designed to also support other top-level declarations, which should be a bigger performance win. That optimization will be next. Note also that there is no mechanism for determining when to throw away the cache and recompute its contents. llvm-svn: 111051