forked from OSchip/llvm-project
[index] 'using namespace' declarations in functions should record
the reference to the namespace rdar://32323190 llvm-svn: 303555
This commit is contained in:
parent
f2dc6492ed
commit
d65b3e4212
|
@ -568,8 +568,12 @@ public:
|
|||
const DeclContext *DC = D->getDeclContext()->getRedeclContext();
|
||||
const NamedDecl *Parent = dyn_cast<NamedDecl>(DC);
|
||||
|
||||
IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), Parent,
|
||||
D->getLexicalDeclContext());
|
||||
// NNS for the local 'using namespace' directives is visited by the body
|
||||
// visitor.
|
||||
if (!D->getParentFunctionOrMethod())
|
||||
IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), Parent,
|
||||
D->getLexicalDeclContext());
|
||||
|
||||
return IndexCtx.handleReference(D->getNominatedNamespaceAsWritten(),
|
||||
D->getLocation(), Parent,
|
||||
D->getLexicalDeclContext(),
|
||||
|
|
|
@ -61,6 +61,8 @@ bool index::isFunctionLocalSymbol(const Decl *D) {
|
|||
if (isa<ObjCTypeParamDecl>(D))
|
||||
return true;
|
||||
|
||||
if (isa<UsingDirectiveDecl>(D))
|
||||
return false;
|
||||
if (!D->getParentFunctionOrMethod())
|
||||
return false;
|
||||
|
||||
|
|
|
@ -339,3 +339,14 @@ void ::ns::inner::func() {
|
|||
// CHECK: [[@LINE-1]]:3 | namespace/C++ | ns | c:@N@ns | <no-cgname> | Ref,RelCont | rel: 1
|
||||
// CHECK: [[@LINE-2]]:7 | namespace-alias/C++ | innerAlias | c:@N@ns@NA@innerAlias | <no-cgname> | Ref,RelCont | rel: 1
|
||||
}
|
||||
|
||||
void innerUsingNamespace() {
|
||||
using namespace ns;
|
||||
// CHECK: [[@LINE-1]]:19 | namespace/C++ | ns | c:@N@ns | <no-cgname> | Ref,RelCont | rel: 1
|
||||
{
|
||||
using namespace ns::innerAlias;
|
||||
// CHECK: [[@LINE-1]]:25 | namespace-alias/C++ | innerAlias | c:@N@ns@NA@innerAlias | <no-cgname> | Ref,RelCont | rel: 1
|
||||
// CHECK: [[@LINE-2]]:21 | namespace/C++ | ns | c:@N@ns | <no-cgname> | Ref,RelCont | rel: 1
|
||||
// CHECK-NOT: [[@LINE-3]]:21
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue