mirror of https://github.com/microsoft/clang.git
[Index] fix USR generation for namespace{extern{X}}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324093 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e705029e94
commit
7d84cfa2cd
|
@ -103,7 +103,7 @@ public:
|
|||
void VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D);
|
||||
|
||||
void VisitLinkageSpecDecl(const LinkageSpecDecl *D) {
|
||||
IgnoreResults = true;
|
||||
IgnoreResults = true; // No USRs for linkage specs themselves.
|
||||
}
|
||||
|
||||
void VisitUsingDirectiveDecl(const UsingDirectiveDecl *D) {
|
||||
|
@ -192,6 +192,8 @@ bool USRGenerator::ShouldGenerateLocation(const NamedDecl *D) {
|
|||
void USRGenerator::VisitDeclContext(const DeclContext *DC) {
|
||||
if (const NamedDecl *D = dyn_cast<NamedDecl>(DC))
|
||||
Visit(D);
|
||||
else if (isa<LinkageSpecDecl>(DC)) // Linkage specs are transparent in USRs.
|
||||
VisitDeclContext(DC->getParent());
|
||||
}
|
||||
|
||||
void USRGenerator::VisitFieldDecl(const FieldDecl *D) {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: c-index-test core -print-source-symbols -- %s | FileCheck %s
|
||||
|
||||
// Linkage decls are skipped in USRs for enclosed items.
|
||||
// Linkage decls themselves don't have USRs (no lines between ns and X).
|
||||
// CHECK: {{[0-9]+}}:11 | namespace/C++ | ns | c:@N@ns |
|
||||
// CHECK-NEXT: {{[0-9]+}}:33 | variable/C | X | c:@N@ns@X |
|
||||
namespace ns { extern "C" { int X; } }
|
Loading…
Reference in New Issue