summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CXIndexDataConsumer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [NFC] Fix typos in Clangd and ClangKirill Bobyrev2019-12-161-5/+5
| | | | | | Reviewed by: Jim Differential Revision: https://reviews.llvm.org/D71455
* Removed dead code from clang/tools/libclang/CXIndexDataConsumer.{cpp,h}Dmitri Gribenko2019-08-141-20/+0
| | | | | | | | | | | | Reviewers: jkorous Subscribers: dexonsmith, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66156 llvm-svn: 368805
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [index] Enhance indexing for module referencesArgyrios Kyrtzidis2018-09-181-1/+3
| | | | | | | * Create a USR for the occurrences of the 'module' symbol kind * Record module references for each identifier in an import declaration llvm-svn: 342484
* Port getLocStart -> getBeginLocStephen Kelly2018-08-091-1/+1
| | | | | | | | | | Reviewers: teemperor! Subscribers: jholewinski, whisperity, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50350 llvm-svn: 339385
* [Index] Return SourceLocation to consumers, not FileID/Offset pair.Sam McCall2018-04-091-9/+5
| | | | | | | | | | | | | | | | | | Summary: The FileID/Offset conversion is lossy. The code takes the fileLoc, which loses e.g. the spelling location in some macro cases. Instead, pass the original SourceLocation which preserves all information, and update consumers to match current behavior. This allows us to fix two bugs in clangd that need the spelling location. Reviewers: akyrtzi, arphaman Subscribers: ilya-biryukov, ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D45014 llvm-svn: 329570
* [libclang] Add `CXSymbolRole role` to CXIdxEntityRefInfoFangrui Song2018-02-121-5/+14
| | | | | | | | | | | | | | | | | | Summary: CXIdxEntityRefInfo contains the member `CXIdxEntityRefKind kind;` to differentiate implicit and direct calls. However, there are more roles defined in SymbolRole. Among them, `Read/Write` are probably the most useful ones as they can be used to differentiate Read/Write occurrences of a symbol for document highlight in a text document. See `export namespace DocumentHighlightKind` on https://microsoft.github.io/language-server-protocol/specification Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42895 llvm-svn: 324914
* [index] Return when DC is null in handleReferenceFangrui Song2018-01-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: DC may sometimes be NULL and getContainerInfo(DC, Container) will dereference a null pointer. Default template arguments (the following example and many test files in https://github.com/nlohmann/json) may cause null pointer dereference. ```c++ template <typename> struct actor; template <template <typename> class Actor = actor> struct terminal; ``` In tools/libclang/CXIndexDataConsumer.cpp#L203 handleReference(ND, Loc, Cursor, dyn_cast_or_null<NamedDecl>(ASTNode.Parent), ASTNode.ContainerDC, ASTNode.OrigE, Kind); `dyn_cast_or_null<NamedDecl>(ASTNode.Parent)` is somehow a null pointer and in tools/libclang/CXIndexDataConsumer.cpp:935 ContainerInfo Container; getContainerInfo(DC, Container); The null DC is casted `ContInfo.cursor = getCursor(cast<Decl>(DC));` and SIGSEGV. ``` See discussions in https://github.com/jacobdufault/cquery/issues/219 https://github.com/jacobdufault/cquery/issues/192 Reviewers: akyrtzi, sammccall, yvvan Reviewed By: sammccall Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D41575 llvm-svn: 322017
* [Index] Reduce size of SymbolInfo struct.Sam McCall2017-12-231-3/+3
| | | | | | | | | | | | | | | | | | | | | Summary: This is currently 16 bytes, the patch reduces it to 4. (Building with clang on linux x84, I guess others are similar) The only subfield that might need a bigger type is SymbolPropertySet, I've moved it to the end of the struct so if it grows, SymbolInfo will only be 8 bytes. With a full index of namespace-scope symbols from the LLVM project (200k) loaded into clangd, this saves ~2MB of RAM. Reviewers: akyrtzi Subscribers: ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41514 llvm-svn: 321411
* [index] Add indexing for unresolved-using declarationsBen Langmuir2017-08-161-0/+1
| | | | | | | | | | | In dependent contexts we end up referencing these, so make sure they have USRs, and have their declarations indexed. For the most part they behave like typedefs, but we also need to worry about having multiple using declarations with the same "name". rdar://problem/33883650 llvm-svn: 311053
* Fix warnings introduced by r307434.Richard Smith2017-07-081-1/+3
| | | | llvm-svn: 307455
* [index] If the 'external_source_symbol' attribute indicates 'Swift' as the ↵Argyrios Kyrtzidis2017-04-241-0/+1
| | | | | | language then report it accordingly llvm-svn: 301183
* [index] Add 'Parameter' symbol kind and 'Local' symbol property to ↵Argyrios Kyrtzidis2017-02-261-0/+1
| | | | | | | | | | | | distinguish function-local symbols Parameters have a 'child' relation to their function/method. Also add an option '-include-locals' to 'c-index-test core' to enable indexing of function-local symbols. Original patch from Nathan Hawes with some changes by me. https://reviews.llvm.org/D30304 llvm-svn: 296282
* [index] When indexing an ObjC method declaration use its base name for the ↵Argyrios Kyrtzidis2017-01-261-3/+4
| | | | | | | | | location. Instead of using the location of the beginning '-'/'+'. This is consistent with location used for function decls and ObjC method calls where we use the base name as the location as well. llvm-svn: 293134
* Move Preprocessor over to std::shared_ptr rather than IntrusiveRefCntPtrDavid Blaikie2017-01-051-2/+2
| | | | llvm-svn: 291166
* [index] Rename SymbolSubKind -> SymbolProperty, NFC.Argyrios Kyrtzidis2016-11-111-6/+6
| | | | | | This better reflects what it represents. llvm-svn: 286680
* When we reach the end of a #include of a header of a local submodule that weRichard Smith2016-09-011-0/+8
| | | | | | | | | | textually included, create an ImportDecl just as we would if we reached a #include of any other modular header. This is necessary in order to correctly determine the set of variables to initialize for an imported module. This should hopefully make the modules selfhost buildbot green again. llvm-svn: 280409
* [index] Change SymbolCXXTemplateKind to a 'SymbolSubKinds' bitset.Argyrios Kyrtzidis2016-04-221-11/+8
| | | | | | This provides a more general and flexible way to annotate special symbols. llvm-svn: 267116
* [index] Fix regression where ObjC method declarations may mistakenly get ↵Argyrios Kyrtzidis2016-03-311-11/+17
| | | | | | | | indexed as definition. rdar://25372906 llvm-svn: 265042
* [index] Remove redundancy between symbol kind and languageBen Langmuir2016-03-251-24/+34
| | | | | | | | | Condense the ObjCKIND and CXXKIND options into just KIND, since the language was already specified on a per-symbol basis and this information was redundant. This only changes the internal representation; naturally the libclang interface remains the same. llvm-svn: 264423
* [index] libclang: Make sure to treat forward ObjC protocols as ↵Argyrios Kyrtzidis2016-03-091-0/+8
| | | | | | | | ObjCProtocolRef declarations, and fix related crash. rdar://25035376 llvm-svn: 262985
* silence -Wreturn-type warningsSaleem Abdulrasool2016-02-151-0/+3
| | | | | | | | These codepaths would generate warnings with GCC on linux even though the switch was covered. Add llvm_unreachable markers to indicate that the switch should be covered. NFC. llvm-svn: 260865
* [libclang] Separate the underlying indexing functionality of libclang and ↵Argyrios Kyrtzidis2016-02-121-0/+1286
introduce it into the clangIndex library. It is a general goodness for libclang itself to mostly be a wrapper of functionality provided by the libraries. llvm-svn: 260760
OpenPOWER on IntegriCloud