aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/libclang/CIndexCodeCompletion.cpp
AgeCommit message (Collapse)AuthorFilesLines
2011-07-21New libclang API to expose container type for code completion, fromDouglas Gregor1-6/+86
Connor Wakamo! llvm-svn: 135651
2011-07-07Introduce a new libclang aPI function,Douglas Gregor1-0/+192
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-05-05When the environment variable LIBCLANG_RESOURCE_USAGE is set, teachDouglas Gregor1-1/+2
libclang to emit information about resource usage after parsing, code completion, etc. llvm-svn: 130946
2011-03-21Improve crash recovery cleanup to recovery CompilerInstances during crash ↵Ted Kremenek1-6/+6
recovery. This was a huge resource "root" during crashes. This change requires making a bunch of fundamental Clang structures (optionally) reference counted to allow correct ownership semantics of these objects (e.g., ASTContext) to play out between an active ASTUnit and CompilerInstance object. llvm-svn: 128011
2011-03-18Correctly store and keep track of the FileSystemOptions in ASTUnit and in ↵Anders Carlsson1-3/+6
clang_codeCompleteAt. llvm-svn: 127890
2011-02-16Teach the CXCodeCompleteResults results structure, which storesDouglas Gregor1-1/+11
code-completion results accessed via libclang, to extend the lifetime of the allocator used for cached global code-completion results at least until these completion results are destroyed. Fixes <rdar://problem/8997369>. llvm-svn: 125678
2011-02-01Fix name lookup issueDouglas Gregor1-1/+1
llvm-svn: 124700
2011-02-01Create a special allocator class for code completion, so that all ofDouglas Gregor1-2/+2
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-48/+26
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-12-07Use atomic operations for libclang's object count tracking.Douglas Gregor1-3/+4
llvm-svn: 121073
2010-11-29Merge System into Support.Michael J. Spencer1-1/+1
llvm-svn: 120297
2010-11-23now the FileManager has a FileSystemOpts ivar, stop threadingChris Lattner1-4/+4
FileSystemOpts through a ton of apis, simplifying a lot of code. This also fixes a latent bug in ASTUnit where it would invoke methods on FileManager without creating one in some code paths in cindextext. llvm-svn: 120010
2010-11-23give FileManager a 'FileSystemOptions' ivar, which will be usedChris Lattner1-1/+3
to simplify a bunch of code in it. It should ultimately get inlined into FileManager. llvm-svn: 120007
2010-11-18Refactoring of Diagnostic class.Argyrios Kyrtzidis1-1/+3
-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class. -DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units. -The rest of the state in Diagnostic object is considered related and tied to one translation unit. -Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a SourceLocation instead of a FullSourceLoc. -Reflect the changes to various interfaces. llvm-svn: 119730
2010-11-17Make definition of CXTranslationUnitImpl privateTed Kremenek1-0/+1
to libclang. llvm-svn: 119585
2010-11-17Fix source-range information for Objective-C properties. Previously,Douglas Gregor1-1/+17
we were just getting a range covering only the property name, which is certainly not correct (and broke token annotation, among other things). Also, teach libclang about the relationship between @synthesize/@dynamic and @property, so we get property name and cursor-reference information for @synthesize and @dynamic. llvm-svn: 119409
2010-11-16Change CXTranslationUnit to not directly cast to an ASTUnit*,Ted Kremenek1-4/+4
but to wrap both an ASTUnit and a "string pool" that will be used for fast USR generation. This requires a bunch of mechanical changes, as there was a ton of code that assumed that CXTranslationUnit and ASTUnit* were the same. Along with this change, introduce CXStringBuf, which provides an llvm::SmallVector<char> backing for repeatedly generating CXStrings without a huge amount of malloc() traffic. This requires making some changes to the representation of CXString by renaming a few fields (but keeping the size of the object the same). llvm-svn: 119337
2010-11-16Move CXString creation/management routines intoTed Kremenek1-0/+1
their own .cpp file and make the interpretation of its flags private. llvm-svn: 119319
2010-11-05libclang: Add some support for running certain entry points in a "safety"Daniel Dunbar1-1/+1
thread, primarily to get a larger stack. - Yes, I feel dirty. llvm-svn: 118274
2010-11-03Implement -working-directory.Argyrios Kyrtzidis1-4/+7
When -working-directory is passed in command line, file paths are resolved relative to the specified directory. This helps both when using libclang (where we can't require the user to actually change the working directory) and to help reproduce test cases when the reproduction work comes along. --FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains the working directory value if set). --FileSystemOptions are passed around to various interfaces that perform file operations. --Opening & reading the content of files should be done only through FileManager. This is useful in general since file operations will be abstracted in the future for the reproduction mechanism. FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same FileManager but with different FileSystemOptions. Addresses rdar://8583824. llvm-svn: 118203
2010-10-18Introduce code completion results for Objective-C methods, both whenDouglas Gregor1-6/+52
declaring methods and when sending messages to them, by bringing all of the selector into TypedCheck chunks in the completion result. This way, we can improve the sorting of these results to account for the full selector name rather than just the first chunk. llvm-svn: 116746
2010-10-11Eliminate clang_codeComplete(). libclang clients should be using theDouglas Gregor1-293/+0
faster, in-process, more-configurable clang_codeCompleteAt(). llvm-svn: 116245
2010-10-11Switch c-index-test from clang_codeComplete() over toDouglas Gregor1-7/+36
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 llvm-svn: 116241
2010-10-08Fix the mapping of vertical-space cursor kinds to produce a newline,Douglas Gregor1-4/+1
rather than a space. llvm-svn: 116097
2010-09-23Add some missing concurrency checks into libclangDouglas Gregor1-0/+2
llvm-svn: 114682
2010-09-10Fix my silly sorting predicate. I hate integer-to-bool conversionsDouglas Gregor1-1/+1
llvm-svn: 113656
2010-09-01Make it clear that libclang does not modify the command-line argumentsDouglas Gregor1-1/+1
it is given. llvm-svn: 112717
2010-08-27Teach clang_codeComplete to always sort its code-completion resultsDouglas Gregor1-0/+1
llvm-svn: 112292
2010-08-26Implement code completion for @selector expressionsDouglas Gregor1-1/+1
llvm-svn: 112186
2010-08-26Move the sorting of code-completion results out of the main path andDouglas Gregor1-0/+35
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-35/+0
path and ...", it is failing tests. llvm-svn: 112161
2010-08-26Revert r112154, "Fix thinko in sorting operation", it depends on r112149 whichDaniel Dunbar1-2/+2
doth lay upon the chopping block. llvm-svn: 112160
2010-08-26Fix thinko in sorting operationDouglas Gregor1-2/+2
llvm-svn: 112154
2010-08-26Move the sorting of code-completion results out of the main path andDouglas Gregor1-0/+35
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-2/+0
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-0/+2
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-25Teach Sema to live without CodeCompleteConsumer.h.John McCall1-1/+1
llvm-svn: 112028
2010-08-23Introduce new libclang API functions that determine the availabilityDouglas Gregor1-4/+21
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-20When performing code-completion in the presence of a preamble, makeDouglas Gregor1-6/+2
sure to (1) actually use the remapped files we were given rather than old data, and (2) keep the remapped files alive until the code-completion results are destroyed. Big thanks to Daniel for the test case. llvm-svn: 111597
2010-08-19libclang: Execute clang_codeCompleteAt() inside a crash recovery context.Daniel Dunbar1-9/+44
- Test case is disabled for now, because something isn't write with file remapping. llvm-svn: 111581
2010-08-15Extend the code-completion caching infrastructure to include globalDouglas Gregor1-1/+2
declarations (in addition to macros). Each kind of declaration maps to a certain set of completion contexts, and the ASTUnit completion logic introduces the completion strings for those declarations if the actual code-completion occurs in one of the contexts where it matters. There are a few new code-completion-context kinds. Without these, certain completions (e.g., after "using namespace") would need to suppress all global completions, which would be unfortunate. Note that we don't get the priorities right for global completions, because we don't have enough type information. We'll need a way to compare types in an ASTContext-agnostic way before this can be implemented. llvm-svn: 111093
2010-08-13Implement caching of code-completion results for macro definitionsDouglas Gregor1-10/+1
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
2010-08-11Once code completion has completed, pass a "completion context" on toDouglas Gregor1-1/+3
the code-completion consumer. The consumer can use this information to augument, filter, or display the code-completion results. llvm-svn: 110858
2010-08-09Minor libclang tweaksDouglas Gregor1-2/+2
llvm-svn: 110599
2010-08-09Use precompiled preambles for in-process code completion.Douglas Gregor1-4/+14
llvm-svn: 110596
2010-08-05Give clang_codeCompleteAt() an "options" parameter, and add a newDouglas Gregor1-2/+10
flags enumeration + default-generating function that allows code-completion to be customized via the libclang API. Plus, turn on spell-checking when performing code completion. llvm-svn: 110319
2010-08-04When performing in-process code completion, don't free the remappedDouglas Gregor1-10/+12
file buffers until the code completion results are destroyed; diagnostics may end up referring into the source. llvm-svn: 110216
2010-08-04Add code-completion support directly to ASTUnit, which performs codeDouglas Gregor1-2/+163
completion within the translation unit using the same command-line arguments for parsing the translation unit. Eventually, we'll reuse the precompiled preamble to improve code-completion performance, and this also gives us a place to cache results. Expose this function via the new libclang function clang_codeCompleteAt(), which performs the code completion within a CXTranslationUnit. The completion occurs in-process (clang_codeCompletion() runs code completion out-of-process). llvm-svn: 110210
2010-07-26When LIBCLANG_CODE_COMPLETION_LOGGING is set in the environment, log ↵Douglas Gregor1-0/+15
code-completion command lines to stderr llvm-svn: 109395
2010-06-30libclang: When invoking external clang process to get code completion results,Daniel Dunbar1-0/+3
pass -ccc-clang-cxx to force C++ support (even if the binary was built without it). llvm-svn: 107324