aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/libclang/CIndexCodeCompletion.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-03-24[libclang] Bury dead TemporaryFilesKrasimir Georgiev1-6/+0
Summary: AllocatedCXCodeCompleteResults::TemporaryFiles have turned into zombies. Seven years ago they used to do their job during [[ https://github.com/llvm-mirror/clang/commit/313e26c4e81f0e467490a530548450f4c824a6c4/tools/CIndex/CIndexCodeCompletion.cpp#diff-02d3e692ad507b10af9458b775c5750bL261 | file remapping]], but now they are created just to be torn down in the destructor. Reviewers: bkramer Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31288 llvm-svn: 298697
2017-03-21Apply clang-tidy's performance-unnecessary-value-param to parts of clang.Benjamin Kramer1-1/+2
No functionality change intended. llvm-svn: 298443
2017-01-06Reapply "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase ↵David Blaikie1-10/+9
and CodeCompleteConsumer" Aleksey Shlypanikov pointed out my mistake in migrating an explicit unique_ptr to auto - I was expecting the function returned a unique_ptr, but instead it returned a raw pointer - introducing a leak. Thanks Aleksey! This reapplies r291184, reverted in r291249. llvm-svn: 291270
2017-01-06Revert "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and ↵David Blaikie1-9/+10
CodeCompleteConsumer" Caused a memory leak reported by asan. Reverting while I investigate. This reverts commit r291184. llvm-svn: 291249
2017-01-05IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and ↵David Blaikie1-10/+9
CodeCompleteConsumer llvm-svn: 291184
2016-12-17[libclang] Remove the 'extern "C"' blocks from the implementation files.Argyrios Kyrtzidis1-12/+3
These are unnecessary, the declarations already carry the 'extern C' property, and if there is mismatch between declaration and definition then we will get linker errors via libclang.exports. llvm-svn: 290025
2015-07-25[libclang] Use lambdas instead of explicit structs when storing arguments.Benjamin Kramer1-29/+21
This boilerplate code was necessary to move arguments between threads in C++98, lambdas make this much easier. No functionality change intended. llvm-svn: 243227
2015-07-07[libclang] Replace ObjC generic parameters in code-completion results.Douglas Gregor1-1/+1
rdar://19369529 llvm-svn: 241557
2015-06-22Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko1-2/+2
llvm-svn: 240353
2015-06-22Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-2/+2
The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
2015-06-20Introduce a PCHContainerOperations interface (NFC).Adrian Prantl1-7/+5
A PCHContainerOperations abstract interface provides operations for creating and unwrapping containers for serialized ASTs (precompiled headers and clang modules). The default implementation is RawPCHContainerOperations, which uses a flat file for the output. The main application for this interface will be an ObjectFilePCHContainerOperations implementation that uses LLVM to wrap the module in an ELF/Mach-O/COFF container to store debug info alongside the AST. rdar://problem/20091852 llvm-svn: 240225
2015-04-11Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko1-1/+1
Summary: The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
2015-03-10Make helper functions static. NFC.Benjamin Kramer1-1/+1
llvm-svn: 231811
2015-01-28Improves overload completion result chunks.Francisco Lopes da Silva1-1/+2
The code building the code completion string for overloads was providing less detail compared to the one building completion strings for function declarations. There was no information about optionals and no information about what's a parameter and what's a function identifier, everything besides ResultType, CurrentParameter and special characters was classified as Text. This makes code completion strings for overload candidates to follow a pattern very similar, but not identical, to the one in use for function declarations: - return type chunk: ResultType - function identifier chunk: Text - parameter chunks: Placeholder - optional parameter chunks: Optional - current parameter chunk: CurrentParameter llvm-svn: 227309
2015-01-21Initial support for C++ parameter completionFrancisco Lopes da Silva1-1/+1
The improved completion in call context now works with: - Functions. - Member functions. - Constructors. - New expressions. - Function call expressions. - Template variants of the previous. There are still rough edges to be fixed: - Provide support for optional parameters. (fix known) - Provide support for member initializers. (fix known) - Provide support for variadic template functions. (fix unknown) - Others? llvm-svn: 226670
2014-08-27Update for LLVM api change.Rafael Espindola1-2/+2
llvm-svn: 216585
2014-07-07libclang: refactor handling of unsaved_filesAlp Toker1-14/+13
Consolidate CXUnsavedFile argument handling in API functions to support a wider cleanup of various file remapping schemes in the frontend. llvm-svn: 212427
2014-06-27Remove 'const' from MemoryBuffers used through the SourceManagerDavid Blaikie1-2/+2
This removes a const_cast added in r211884 that occurred due to an inconsistency in how MemoryBuffers are handled between some parts of clang and LLVM. MemoryBuffers are immutable and the general convention in the LLVM project is to omit const from immutable types as it's simply redundant/verbose (see llvm::Type, for example). While this change doesn't remove "const" from /every/ MemoryBuffer, it at least makes this chain of ownership/usage consistent. llvm-svn: 211915
2014-06-08[C++11] Use 'nullptr'. Tools edition.Craig Topper1-15/+15
llvm-svn: 210422
2014-05-09Don't leak the CXStoredDiagnostics returned by clang_codeCompleteGetDiagnostic()Nico Weber1-2/+12
r144269 changed clang_disposeDiagnostic() to be a no-op, but didn't update code completion diagnostics. Let CXCodeCompleteResults store all diagnostics returned by clang_codeCompleteGetDiagnostic() and then free them up in clang_disposeCodeCompleteResults(). Code completion diagnostics referred to data stored in CXCodeCompleteResults before already, so it wasn't possible to refer to the results of clang_codeCompleteGetDiagnostic() after clang_disposeCodeCompleteResults() before this change already -- hence this should be a safe, backwards-compatible change. Leak found by LSan, fixes PR19690. llvm-svn: 208454
2014-04-15Honour -ivfsoverlay in ASTUnit to match clangBen Langmuir1-19/+12
This allows code indexing, etc. to use the VFS in the same way as the compiler. llvm-svn: 206309
2014-03-15[C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper1-13/+13
class. llvm-svn: 204002
2014-03-02[C++11] Use std::atomic instead of LLVM's.Benjamin Kramer1-10/+8
No intended functionality change. llvm-svn: 202652
2014-02-11Fix a typo in the function name that I just introduced (r201155)Dmitri Gribenko1-1/+1
llvm-svn: 201156
2014-02-11libclang: audit all APIs that accept a CXTranslationUnit to make sure thatDmitri Gribenko1-1/+6
checks for invalid translation unit are in place. Also, while there, add log output for this case. llvm-svn: 201155
2014-02-07ASTUnit: ArrayRef'ize RemappedFilesDmitri Gribenko1-1/+1
llvm-svn: 200975
2013-09-13Remove unnecessary inclusion of Sema.hDavid Blaikie1-0/+1
Let me tell you a tale... Within some twisted maze of debug info I've ended up implementing an insane man's Include What You Use device. When the debugger emits debug info it really shouldn't, I find out why & then realize the code could be improved too. In this instance CIndexDiagnostics.cpp had a lot more debug info with Clang than GCC. Upon inspection a major culprit was all the debug info describing clang::Sema. This was emitted because clang::Sema is befriended by DiagnosticEngine which was rightly required, but GCC doesn't emit debug info for friends so it never emitted anything for Clang. Clang does emit debug info for friends (will be fixed/changed to reduce debug info size). But why didn't Clang just emit a declaration of Sema if this entire TU didn't require a definition? 1) Diagnostic.h did the right thing, only using a declaration of Sema and not including Sema.h at all. 2) Some other dependency of CIndexDiagnostics.cpp didn't do the right thing. ASTUnit.h, only needing a declaration, still included Sema.h (hence this commit which removes that include and adds the necessary includes to the cpp files that were relying on this) 3) -flimit-debug-info didn't save us because of EnterExpressionEvaluationContext, defined inline in Sema.h which fires the "requiresCompleteType" check/flag (since it uses nested types from Sema and calls Sema member functions) and thus, if debug info is ever emitted for the type, the whole type is emitted and not just a declaration. Improving -flimit-debug-info to account for this would be... hard. Modifying the code so that's not 'required to be complete' might be possible, but probably only by moving EnterExpressionEvaluationContext either into Sema, or out of Sema.h. That might be a bit too much of a contortion to be bothered with. Also, this is only one of the cases where emitting debug info for friends caused us to emit a lot more debug info (this change reduces Clang's DWO size by 0.93%, dropping friends entirely reduces debug info by 3.2%) - I haven't hunted down the other cases, but I assume they might be similar (Sema or something like it). IWYU or a similar tool might help us reduce build times a bit, but analyzing debug info to find these differences isn't worthwhile. I'll take the 3.2% win, provide this small improvement to the code itself, and move on. llvm-svn: 190715
2013-06-26Don't use PathV1.h in CIndexCodeCompletion.cpp.Rafael Espindola1-3/+3
llvm-svn: 184940
2013-06-18Simplify a loop in ProcessCodeCompleteResults(). Pointed out by David BlaikieDmitri Gribenko1-6/+6
llvm-svn: 184169
2013-06-18ArrayRef'ize CodeCompletionContext::getNumSelIdents()Dmitri Gribenko1-8/+6
llvm-svn: 184168
2013-06-13Use the sys::ExecuteAndWait that takes StringRefs.Rafael Espindola1-0/+1
Also don't depend on Program.h including PathV1.h. llvm-svn: 183935
2013-02-07libclang: reduce CXString abuseDmitri Gribenko1-25/+20
ContainerUSR is not really a CXString, but it should own the underlying memory buffer. Thus, it is better to change the type to std::string. This will not introduce extra copying overhead, since the workaround that is being removed was already making a copy. llvm-svn: 174647
2013-02-03libclang: remove 'using namespace cxstring'Dmitri Gribenko1-1/+0
llvm-svn: 174285
2013-02-02libclang: introduce cxstring::{createRef,createDup} for StringRefsDmitri Gribenko1-2/+2
Also migrate all clients from the old API. llvm-svn: 174263
2013-02-02libclang: introduce cxstring::{createRef,createDup} for C stringsDmitri Gribenko1-6/+5
Also migrate all clients from the old API. llvm-svn: 174238
2013-02-01libclang: itroduce cxstring::createEmpty()Dmitri Gribenko1-5/+5
llvm-svn: 174174
2013-02-01libclang: introduce cxstring::createNull()Dmitri Gribenko1-4/+4
llvm-svn: 174173
2013-01-26libclang: type safety for CXTranslationUnitImpl::CIdxDmitri Gribenko1-1/+1
llvm-svn: 173590
2013-01-26libclang: factor out the frequent pattern static_cast<ASTUnit *>(TU->TUData)Dmitri Gribenko1-2/+2
into a getter cxtu::getASTUnit(TU) llvm-svn: 173585
2013-01-19Re-sort all the headers. Lots of regressions have crept in here.Chandler Carruth1-1/+1
Manually fix the order of UnwrappedLineParser.cpp as that one didn't have its associated header as the first header. This also uncovered a subtle inclusion order dependency as CLog.h didn't include LLVM.h to pick up using declarations it relied upon. llvm-svn: 172892
2013-01-10[libclang] Enhance logging capabilities of libclang.Argyrios Kyrtzidis1-0/+7
-provide a "raw_ostream'ish" class to make it convenient to output logging info. -use macros to automate a bit the logging functionality inside libclang functions -when logging, print a stack trace if "LIBCLANG_LOGGING=2" environment is set. -add logging to more functions. llvm-svn: 172089
2013-01-02Re-sort #include lines using the llvm/utils/sort_includes.py script.Chandler Carruth1-1/+0
Removes a duplicate #include as well as cleaning up some sort order regressions since I last ran the script over Clang. llvm-svn: 171364
2012-12-22[libclang] Check for the 'LIBCLANG_NOTHREADS' environment variable before ↵Argyrios Kyrtzidis1-0/+6
creating a separate thread for code-completion. llvm-svn: 170978
2012-12-04Sort #include lines for tools/...Chandler Carruth1-7/+7
Completely automated with sort_includes.py llvm-svn: 169240
2012-11-22Make helpers static/anonymous.Benjamin Kramer1-1/+4
llvm-svn: 168500
2012-10-23Make DiagnosticOptions intrusively reference-counted, and make sureDouglas Gregor1-1/+5
the various stakeholders bump up the reference count. In particular, the diagnostics engine now keeps the DiagnosticOptions object alive. llvm-svn: 166508
2012-09-26[libclang] Remove the ParentKind cursor kind from code-completion results.Argyrios Kyrtzidis1-2/+0
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-4/+21
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-04-10[code-complete] Introduce CodeCompletionTUInfo which will be used for cachingArgyrios Kyrtzidis1-7/+13
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-28[libclang] Rename setBackGroundPriority -> setThreadBackgroundPriority.Argyrios Kyrtzidis1-1/+1
llvm-svn: 153566