forked from OSchip/llvm-project
[AST] namespace ns { extern "C" { int X; }} prints as "ns::X", not as "X"
llvm-svn: 324081
This commit is contained in:
parent
492f1cc8c7
commit
34f9d3fe2a
|
@ -1497,9 +1497,10 @@ void NamedDecl::printQualifiedName(raw_ostream &OS,
|
|||
using ContextsTy = SmallVector<const DeclContext *, 8>;
|
||||
ContextsTy Contexts;
|
||||
|
||||
// Collect contexts.
|
||||
while (Ctx && isa<NamedDecl>(Ctx)) {
|
||||
Contexts.push_back(Ctx);
|
||||
// Collect named contexts.
|
||||
while (Ctx) {
|
||||
if (isa<NamedDecl>(Ctx))
|
||||
Contexts.push_back(Ctx);
|
||||
Ctx = Ctx->getParent();
|
||||
}
|
||||
|
||||
|
|
|
@ -173,3 +173,10 @@ TEST(NamedDeclPrinter, TestClassWithScopedNamedEnum) {
|
|||
"A",
|
||||
"X::Y::A"));
|
||||
}
|
||||
|
||||
TEST(NamedDeclPrinter, TestLinkageInNamespace) {
|
||||
ASSERT_TRUE(PrintedWrittenNamedDeclCXX11Matches(
|
||||
"namespace X { extern \"C\" { int A; } }",
|
||||
"A",
|
||||
"X::A"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue