summaryrefslogtreecommitdiffstats
path: root/clang/lib/Index/IndexDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove Expr.h include from ASTContext.h, NFCReid Kleckner2019-12-061-1/+2
| | | | | | | ASTContext.h is popular, prune its includes. Expr.h brings in Attr.h, which is also expensive. Move BlockVarCopyInit to Expr.h to accomplish this.
* Redeclare Objective-C property accessors inside the ObjCImplDecl in which ↵Adrian Prantl2019-11-081-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | they are synthesized. This patch is motivated by (and factored out from) https://reviews.llvm.org/D66121 which is a debug info bugfix. Starting with DWARF 5 all Objective-C methods are nested inside their containing type, and that patch implements this for synthesized Objective-C properties. 1. SemaObjCProperty populates a list of synthesized accessors that may need to inserted into an ObjCImplDecl. 2. SemaDeclObjC::ActOnEnd inserts forward-declarations for all accessors for which no override was provided into their ObjCImplDecl. This patch does *not* synthesize AST function *bodies*. Moving that code from the static analyzer into Sema may be a good idea though. 3. Places that expect all methods to have bodies have been updated. I did not update the static analyzer's inliner for synthesized properties to point back to the property declaration (see test/Analysis/Inputs/expected-plists/nullability-notes.m.plist), which I believed to be more bug than a feature. Differential Revision: https://reviews.llvm.org/D68108 rdar://problem/53782400
* Fix parameter name comments using clang-tidy. NFC.Rui Ueyama2019-07-161-2/+2
| | | | | | | | | | | | | | | | | | | | | This patch applies clang-tidy's bugprone-argument-comment tool to LLVM, clang and lld source trees. Here is how I created this patch: $ git clone https://github.com/llvm/llvm-project.git $ cd llvm-project $ mkdir build $ cd build $ cmake -GNinja -DCMAKE_BUILD_TYPE=Debug \ -DLLVM_ENABLE_PROJECTS='clang;lld;clang-tools-extra' \ -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DLLVM_ENABLE_LLD=On \ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm $ ninja $ parallel clang-tidy -checks='-*,bugprone-argument-comment' \ -config='{CheckOptions: [{key: StrictMode, value: 1}]}' -fix \ ::: ../llvm/lib/**/*.{cpp,h} ../clang/lib/**/*.{cpp,h} ../lld/**/*.{cpp,h} llvm-svn: 366177
* [Concepts] Concept definitions (D40381)Saar Raz2019-07-101-2/+2
| | | | | | | First in a series of patches to land C++2a Concepts support. This patch adds AST and parsing support for concept-declarations. llvm-svn: 365699
* [clang][Index] Mark references from Constructors and Destructors to class as ↵Kadir Cetinkaya2019-03-081-2/+4
| | | | | | | | | | | | | | | | | | | | | | NameReference Summary: In current indexing logic we get references to class itself when we see a constructor/destructor which is only syntactically true. Semantically this information is not correct. This patch marks that reference as NameReference to let clients deal with it. Reviewers: akyrtzi, gribozavr, nathawes, benlangmuir Reviewed By: gribozavr, nathawes Subscribers: nathawes, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58814 llvm-svn: 355668
* [index] Improve indexing support for MSPropertyDecl.Volodymyr Sapsai2019-02-271-0/+1
| | | | | | | | | | | | | | | | | Currently the symbol for MSPropertyDecl has kind `SymbolKind::Unknown` which can trip up various indexing tools. rdar://problem/46764224 Reviewers: akyrtzi, benlangmuir, jkorous Reviewed By: jkorous Subscribers: dexonsmith, cfe-commits, jkorous, jdoerfert, arphaman Differential Revision: https://reviews.llvm.org/D57628 llvm-svn: 354942
* [clang][Index] Visit UsingDecls and generate USRs for themKadir Cetinkaya2019-02-261-1/+2
| | | | | | | | | | | | | | | | | Summary: Add indexing of UsingDecl itself. Also enable generation of USRs for UsingDecls, using the qualified name of the decl. Reviewers: ilya-biryukov, akyrtzi Subscribers: arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58340 llvm-svn: 354878
* [clang][Index] Enable indexing of Template Type Parameters behind a flagKadir Cetinkaya2019-02-211-0/+2
| | | | | | | | | | | | | | | | | Summary: clangd uses indexing api to provide references and it was not possible to perform symbol information for template parameters. This patch enables visiting of TemplateTypeParmTypeLocs. Reviewers: ilya-biryukov, akyrtzi Subscribers: javed.absar, kristof.beyls, ioeric, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58293 llvm-svn: 354560
* [clang][Index] Add a knob to index function parameters in declarationsKadir Cetinkaya2019-02-111-4/+4
| | | | | | | | | | | | | | | | | Summary: Parameters in declarations are useful for clangd, so that we can provide symbol information for them as well. It also helps clangd to be consistent whether a function's definition is accessible or not. Reviewers: hokein, akyrtzi Subscribers: ilya-biryukov, ioeric, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57949 llvm-svn: 353695
* 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
* 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] Add index::IndexingOptions::IndexImplicitInstantiationFangrui Song2018-07-091-1/+1
| | | | | | | | | | | | | | | | | Summary: With IndexImplicitInstantiation=true, the following case records an occurrence of B::bar in A::foo, which will benefit cross reference tools. template <class T> struct B { void bar() {}}; template <class T> struct A { void foo(B<T> *x) { x->bar(); }}; int main() { A<int> a; a.foo(0); } Reviewers: akyrtzi, arphaman, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49002 llvm-svn: 336606
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-1/+1
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* [index] Fix crash when indexing a C++14 PCH/module related to ↵Argyrios Kyrtzidis2018-01-261-2/+5
| | | | | | | | | | | | | TemplateTemplateParmDecls of alias templates TemplateTemplateParmDecls of alias templates ended-up serialized as 'file-level decls' which was causing a crash while trying to index a PCH/module file that contained them. Commit makes sure TemplateTemplateParmDecls are not recorded as such kind of decls. Fixes crash of rdar://36608297 Differential Revision: https://reviews.llvm.org/D42588 llvm-svn: 323549
* Refactor overridden methods iteration to avoid double lookups.Benjamin Kramer2017-12-171-3/+2
| | | | | | Convert most uses to range-for loops. No functionality change intended. llvm-svn: 320954
* [index] tag declarations should use the decl role instead of refAlex Lorenz2017-11-091-4/+2
| | | | | | | | | The 'decl' role is more canonical than the 'ref'. This helps us establish the 'specialization-of' relation just by looking at decls or defs. rdar://31884960 llvm-svn: 317832
* Fix indexer crash for default template template parameter valueJan Korous2017-10-101-2/+1
| | | | | | | | rdar://33058798 Differential Revision: https://reviews.llvm.org/D38755 llvm-svn: 315367
* [index] Add indexing for unresolved-using declarationsBen Langmuir2017-08-161-0/+18
| | | | | | | | | | | 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
* [index] Update indexing to handle CXXDeductionGuideDecls properlyArgyrios Kyrtzidis2017-08-151-0/+4
| | | | | | | | | | | CXXDeductionGuideDecls can't be referenced so there's no need to output a symbol occurrence for them. Also handle DeducedTemplateSpecializationTypeLocs in the TypeIndexer so we don't miss the symbol occurrences of the corresponding template decls. Patch by Nathan Hawes! Differential Revision: https://reviews.llvm.org/D36641 llvm-svn: 310933
* [index] Index nested name qualifiers in a forward declaration of aAlex Lorenz2017-07-041-0/+2
| | | | | | | | class template specialization rdar://33122110 llvm-svn: 307074
* [index] Add the "SpecializationOf" relation to the forward declarationsAlex Lorenz2017-06-221-12/+10
| | | | | | | | | | | | | | of class template specializations This commit fixes an issue where a forward declaration of a class template specialization was not related to the base template. We need to relate even forward declarations because specializations don't have to be defined. rdar://32869409 Differential Revision: https://reviews.llvm.org/D34462 llvm-svn: 305996
* [index] Nested class declarations should be annotated with theAlex Lorenz2017-06-211-1/+3
| | | | | | | | | | | | | | | | | | | "specializationOf" relation if they pseudo-override a type in the base template This commit fixes an issue where Xcode's renaming engine couldn't find the reference to the second occurrence of "InnerClass" in this example: template<typename T> struct Ts { template<typename U> struct InnerClass { }; }; template<> struct Ts<int> { template<typename U> struct InnerClass; // This occurrence wasn't renamed }; rdar://31884960 Differential Revision: https://reviews.llvm.org/D34392 llvm-svn: 305911
* [index] Record C++17 global binding declarationsAlex Lorenz2017-06-151-0/+6
| | | | | | | | The global C++17 binding declarations should be indexed as variable symbols. Differential Revision: https://reviews.llvm.org/D33920 llvm-svn: 305508
* [index] Index static_assert declarationsAlex Lorenz2017-06-151-0/+7
| | | | | | | | | | static_assert declarations have to be visited while indexing so that we can gather the references to declarations that are present in their assert expression. Differential Revision: https://reviews.llvm.org/D33913 llvm-svn: 305504
* [index] Index the default template parameter valuesAlex Lorenz2017-05-221-0/+46
| | | | | | rdar://32323724 llvm-svn: 303568
* [index] Index the deleted functionsAlex Lorenz2017-05-221-3/+0
| | | | | | rdar://32323386 llvm-svn: 303563
* [index] Visit the default argument values in function definitionsAlex Lorenz2017-05-221-0/+11
| | | | | | rdar://32323315 llvm-svn: 303559
* [index] 'using namespace' declarations in functions should recordAlex Lorenz2017-05-221-2/+6
| | | | | | | | the reference to the namespace rdar://32323190 llvm-svn: 303555
* [index] Visit and store information about namespace alias declarationsAlex Lorenz2017-05-151-0/+8
| | | | | | rdar://32195226 llvm-svn: 303048
* [index] Index template specialization arguments for function templatsAlex Lorenz2017-05-121-0/+22
| | | | | | | | Also ensure that class template specialization arguments are covered rdar://31812032 llvm-svn: 302918
* [Index] The relation between the declarations in templateAlex Lorenz2017-05-041-3/+1
| | | | | | | | | | specializations that 'override' declarations in the base template should use the 'specializationOf' relation instead of 'specializationOf | overrideOf'. The indexer relations are meant to be orthogonal, so 'specializationOf' is better than the combined relation. llvm-svn: 302136
* [index] Mark the ObjC implicit accessor method definitions as 'dynamic' as wellArgyrios Kyrtzidis2017-04-271-4/+4
| | | | llvm-svn: 301548
* [index] Index type source info for class specializationsAlex Lorenz2017-04-251-0/+3
| | | | | | rdar://31758344 llvm-svn: 301315
* [index] Record the 'SpecializationOf' relation for function specializationsAlex Lorenz2017-04-251-0/+4
| | | | | | rdar://31603531 llvm-svn: 301310
* [index] The relation between the declarations in template specializationsAlex Lorenz2017-04-241-4/+60
| | | | | | | | | | | | that 'override' declarations in the base template should be recorded This can be used for improved "go to definition" feature in Xcode. rdar://31604739 Differential Revision: https://reviews.llvm.org/D32020 llvm-svn: 301180
* [index] Take advantage of 'external_source_symbol' attribute for indexing ↵Argyrios Kyrtzidis2017-04-211-28/+24
| | | | | | | | | purposes - Ignore decls marked as 'generated_declaration' - Include the 'defined_in' in the USR for additional namespacing llvm-svn: 300949
* [index] For 'transparent' tag typedefs, ignore their tag referenceArgyrios Kyrtzidis2017-04-211-2/+3
| | | | llvm-svn: 300948
* [index] Record class template specializations using a new 'SpecializationOf'Alex Lorenz2017-04-201-2/+12
| | | | | | | | | | relationship rdar://31603531 Differential Revision: https://reviews.llvm.org/D32010 llvm-svn: 300832
* [index/AST] Determine if a typedef shares a name and spelling location with ↵Argyrios Kyrtzidis2017-03-211-2/+3
| | | | | | | | | | its underlying tag type In such a case, as when using the NS_ENUM macro, for indexing purposes treat the typedef as 'transparent', meaning we treat its references as symbols of the underlying tag symbol. Also provide a libclang API to check for such typedefs. llvm-svn: 298392
* [index] For C++ constructors/destructors, add references to the parent type ↵Argyrios Kyrtzidis2017-03-171-0/+9
| | | | | | | | | where its name appears in definitions and declarations Patch by Nathan Hawes! https://reviews.llvm.org/D30730 llvm-svn: 298170
* [index/AST] Add references for ObjC getter=/setter= property attributes and ↵Argyrios Kyrtzidis2017-03-161-2/+21
| | | | | | | | | | | related property getter/setter role fixes This enhances the AST to keep track of locations of the names in those ObjC property attributes, and reports them for indexing. Patch by Nathan Hawes! https://reviews.llvm.org/D30907 llvm-svn: 297972
* [index] ObjC: Improve handling of typedefs as base names in ObjC interface ↵Argyrios Kyrtzidis2017-03-041-8/+27
| | | | | | | | | declarations - Report the typedef reference occurrence - Mark super or protocol references as 'implicit' when they come from a typedef. llvm-svn: 296974
* [index] Improvde how we handle synthesized ObjC properties and the ↵Argyrios Kyrtzidis2017-02-171-30/+57
| | | | | | | | | | | | associated ivars. Related synthesized properties with the ivar they use with the 'accessor' relation, and make sure we mark them 'implicit' when appropriate. Patch by Nathan Hawes! https://reviews.llvm.org/D30012 llvm-svn: 295416
* [index] When indexing an ObjC method declaration use its base name for the ↵Argyrios Kyrtzidis2017-01-261-1/+7
| | | | | | | | | 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
* [index] Ignore invalid ObjC categories.Argyrios Kyrtzidis2017-01-111-5/+6
| | | | | | We currently are unable to get a USR for those and it doesn't seem useful to try to index them. llvm-svn: 291705
* [index] Add 'IBTypeOf' relation for ObjC methods marked with IBAction and ↵Argyrios Kyrtzidis2017-01-111-4/+13
| | | | | | properties with IBOutletCollection. llvm-svn: 291703
* [index] Fixes for locations and relations in Objective C categories and ↵Argyrios Kyrtzidis2016-10-251-9/+37
| | | | | | | | | | | getters/setters - Add entries for protocols on categories - Add relation between categories and class they extend - Add relation between getters/setters and their corresponding property - Use category name location as the location of category decls/defs if it has one llvm-svn: 285120
* Use more ArrayRefsDavid Majnemer2016-06-241-2/+2
| | | | | | No functional change is intended, just a small refactoring. llvm-svn: 273647
* [index] libclang: Make sure to treat forward ObjC protocols as ↵Argyrios Kyrtzidis2016-03-091-4/+4
| | | | | | | | ObjCProtocolRef declarations, and fix related crash. rdar://25035376 llvm-svn: 262985
* [index] Report references of ObjC super class/protocols in interfaces and ↵Argyrios Kyrtzidis2016-03-031-6/+31
| | | | | | protocols. llvm-svn: 262584
OpenPOWER on IntegriCloud