From 324f918438715b4a0d024af5930628c1674f4fcd Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sat, 19 Jan 2019 08:50:56 +0000 Subject: Update the file headers across all of the LLVM projects in the monorepo 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Index/IndexDecl.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/Index/IndexDecl.cpp') diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index a7725f9dd9..aa73d937df 100644 --- a/lib/Index/IndexDecl.cpp +++ b/lib/Index/IndexDecl.cpp @@ -1,9 +1,8 @@ //===- IndexDecl.cpp - Indexing declarations ------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -- cgit v1.2.3 From 13553b75f535a142a1c30ef711202f48112f55f1 Mon Sep 17 00:00:00 2001 From: Kadir Cetinkaya Date: Mon, 11 Feb 2019 13:02:21 +0000 Subject: [clang][Index] Add a knob to index function parameters in declarations 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353695 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Index/IndexDecl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/Index/IndexDecl.cpp') diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index aa73d937df..eb0b3d4a70 100644 --- a/lib/Index/IndexDecl.cpp +++ b/lib/Index/IndexDecl.cpp @@ -88,12 +88,11 @@ public: /*isBase=*/false, isIBType); IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), Parent); if (IndexCtx.shouldIndexFunctionLocalSymbols()) { - // Only index parameters in definitions, parameters in declarations are - // not useful. if (const ParmVarDecl *Parm = dyn_cast(D)) { auto *DC = Parm->getDeclContext(); if (auto *FD = dyn_cast(DC)) { - if (FD->isThisDeclarationADefinition()) + if (IndexCtx.shouldIndexParametersInDeclarations() || + FD->isThisDeclarationADefinition()) IndexCtx.handleDecl(Parm); } else if (auto *MD = dyn_cast(DC)) { if (MD->isThisDeclarationADefinition()) @@ -102,7 +101,8 @@ public: IndexCtx.handleDecl(Parm); } } else if (const FunctionDecl *FD = dyn_cast(D)) { - if (FD->isThisDeclarationADefinition()) { + if (IndexCtx.shouldIndexParametersInDeclarations() || + FD->isThisDeclarationADefinition()) { for (auto PI : FD->parameters()) { IndexCtx.handleDecl(PI); } -- cgit v1.2.3 From 06c2fc247a5267edc8be4c12997139046ae51a5f Mon Sep 17 00:00:00 2001 From: Kadir Cetinkaya Date: Thu, 21 Feb 2019 09:52:33 +0000 Subject: [clang][Index] Enable indexing of Template Type Parameters behind a flag 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354560 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Index/IndexDecl.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/Index/IndexDecl.cpp') diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index eb0b3d4a70..0f6d6212a2 100644 --- a/lib/Index/IndexDecl.cpp +++ b/lib/Index/IndexDecl.cpp @@ -672,6 +672,8 @@ public: shouldIndexTemplateParameterDefaultValue(Parent)) { const TemplateParameterList *Params = D->getTemplateParameters(); for (const NamedDecl *TP : *Params) { + if (IndexCtx.shouldIndexTemplateParameters()) + IndexCtx.handleDecl(TP); if (const auto *TTP = dyn_cast(TP)) { if (TTP->hasDefaultArgument()) IndexCtx.indexTypeSourceInfo(TTP->getDefaultArgumentInfo(), Parent); -- cgit v1.2.3 From 1540b2e60faa129f45518b3c6a28492b3ce3d478 Mon Sep 17 00:00:00 2001 From: Kadir Cetinkaya Date: Tue, 26 Feb 2019 14:23:12 +0000 Subject: [clang][Index] Visit UsingDecls and generate USRs for them 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354878 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Index/IndexDecl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/Index/IndexDecl.cpp') diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index 0f6d6212a2..36f93106ff 100644 --- a/lib/Index/IndexDecl.cpp +++ b/lib/Index/IndexDecl.cpp @@ -580,9 +580,10 @@ public: } bool VisitUsingDecl(const UsingDecl *D) { + IndexCtx.handleDecl(D); + const DeclContext *DC = D->getDeclContext()->getRedeclContext(); const NamedDecl *Parent = dyn_cast(DC); - IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), Parent, D->getLexicalDeclContext()); for (const auto *I : D->shadows()) -- cgit v1.2.3 From 33184f7554f5ed63b09b958bcb406a154cca99ae Mon Sep 17 00:00:00 2001 From: Volodymyr Sapsai Date: Wed, 27 Feb 2019 01:04:53 +0000 Subject: [index] Improve indexing support for MSPropertyDecl. 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354942 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Index/IndexDecl.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/Index/IndexDecl.cpp') diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index 36f93106ff..d7835c51d0 100644 --- a/lib/Index/IndexDecl.cpp +++ b/lib/Index/IndexDecl.cpp @@ -324,6 +324,7 @@ public: } bool VisitMSPropertyDecl(const MSPropertyDecl *D) { + TRY_DECL(D, IndexCtx.handleDecl(D)); handleDeclarator(D); return true; } -- cgit v1.2.3 From 87becae02c7bcddcc684aa2f1d4191cdfee78c8e Mon Sep 17 00:00:00 2001 From: Kadir Cetinkaya Date: Fri, 8 Mar 2019 08:30:20 +0000 Subject: [clang][Index] Mark references from Constructors and Destructors to class as 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355668 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Index/IndexDecl.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/Index/IndexDecl.cpp') diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index d7835c51d0..7e6be5d7f6 100644 --- a/lib/Index/IndexDecl.cpp +++ b/lib/Index/IndexDecl.cpp @@ -247,7 +247,8 @@ public: if (const CXXConstructorDecl *Ctor = dyn_cast(D)) { IndexCtx.handleReference(Ctor->getParent(), Ctor->getLocation(), - Ctor->getParent(), Ctor->getDeclContext()); + Ctor->getParent(), Ctor->getDeclContext(), + (unsigned)SymbolRole::NameReference); // Constructor initializers. for (const auto *Init : Ctor->inits()) { @@ -263,7 +264,8 @@ public: if (auto TypeNameInfo = Dtor->getNameInfo().getNamedTypeInfo()) { IndexCtx.handleReference(Dtor->getParent(), TypeNameInfo->getTypeLoc().getBeginLoc(), - Dtor->getParent(), Dtor->getDeclContext()); + Dtor->getParent(), Dtor->getDeclContext(), + (unsigned)SymbolRole::NameReference); } } else if (const auto *Guide = dyn_cast(D)) { IndexCtx.handleReference(Guide->getDeducedTemplate()->getTemplatedDecl(), -- cgit v1.2.3