r303048 - [index] Visit and store information about namespace alias declarations
Alex Lorenz via cfe-commits
cfe-commits at lists.llvm.org
Mon May 15 03:56:32 PDT 2017
Author: arphaman
Date: Mon May 15 05:56:31 2017
New Revision: 303048
URL: http://llvm.org/viewvc/llvm-project?rev=303048&view=rev
Log:
[index] Visit and store information about namespace alias declarations
rdar://32195226
Modified:
cfe/trunk/lib/Index/IndexDecl.cpp
cfe/trunk/test/Index/Core/index-source.cpp
Modified: cfe/trunk/lib/Index/IndexDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexDecl.cpp?rev=303048&r1=303047&r2=303048&view=diff
==============================================================================
--- cfe/trunk/lib/Index/IndexDecl.cpp (original)
+++ cfe/trunk/lib/Index/IndexDecl.cpp Mon May 15 05:56:31 2017
@@ -544,6 +544,14 @@ public:
return true;
}
+ bool VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) {
+ TRY_DECL(D, IndexCtx.handleDecl(D));
+ IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), D);
+ IndexCtx.handleReference(D->getAliasedNamespace(), D->getTargetNameLoc(), D,
+ D->getLexicalDeclContext());
+ return true;
+ }
+
bool VisitUsingDecl(const UsingDecl *D) {
const DeclContext *DC = D->getDeclContext()->getRedeclContext();
const NamedDecl *Parent = dyn_cast<NamedDecl>(DC);
Modified: cfe/trunk/test/Index/Core/index-source.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Core/index-source.cpp?rev=303048&r1=303047&r2=303048&view=diff
==============================================================================
--- cfe/trunk/test/Index/Core/index-source.cpp (original)
+++ cfe/trunk/test/Index/Core/index-source.cpp Mon May 15 05:56:31 2017
@@ -323,8 +323,15 @@ void func();
}
namespace innerAlias = inner;
+// CHECK: [[@LINE-1]]:11 | namespace-alias/C++ | innerAlias | c:@N at ns@NA at innerAlias | <no-cgname> | Decl,RelChild | rel: 1
+// CHECK: [[@LINE-2]]:24 | namespace/C++ | inner | c:@N at ns@N at inner | <no-cgname> | Ref,RelCont | rel: 1
}
+namespace namespaceAlias = ::ns::innerAlias;
+// CHECK: [[@LINE-1]]:11 | namespace-alias/C++ | namespaceAlias | c:@NA at namespaceAlias | <no-cgname> | Decl | rel: 0
+// CHECK: [[@LINE-2]]:30 | namespace/C++ | ns | c:@N at ns | <no-cgname> | Ref,RelCont | rel: 1
+// CHECK: [[@LINE-3]]:34 | namespace-alias/C++ | innerAlias | c:@N at ns@NA at innerAlias | <no-cgname> | Ref,RelCont | rel: 1
+
void ::ns::inner::func() {
// CHECK: [[@LINE-1]]:8 | namespace/C++ | ns | c:@N at ns | <no-cgname> | Ref,RelCont | rel: 1
// CHECK: [[@LINE-2]]:12 | namespace/C++ | inner | c:@N at ns@N at inner | <no-cgname> | Ref,RelCont | rel: 1
More information about the cfe-commits
mailing list