forked from OSchip/llvm-project
Fix crash in getFullyQualifiedName for inline namespace
Summary: The ICE happens when the most outer namespace is an inline namespace. Reviewers: bkramer, ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ebevhan, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71962
This commit is contained in:
parent
8612e92ed5
commit
128f39da93
|
@ -192,7 +192,7 @@ static NestedNameSpecifier *createOuterNNS(const ASTContext &Ctx, const Decl *D,
|
|||
// Ignore inline namespace;
|
||||
NS = dyn_cast<NamespaceDecl>(NS->getDeclContext());
|
||||
}
|
||||
if (NS->getDeclName()) {
|
||||
if (NS && NS->getDeclName()) {
|
||||
return createNestedNameSpecifier(Ctx, NS, WithGlobalNsPrefix);
|
||||
}
|
||||
return nullptr; // no starting '::', no anonymous
|
||||
|
|
|
@ -223,6 +223,17 @@ TEST(QualTypeNameTest, getFullyQualifiedName) {
|
|||
"}\n"
|
||||
);
|
||||
|
||||
TypeNameVisitor InlineNamespace;
|
||||
InlineNamespace.ExpectedQualTypeNames["c"] = "B::C";
|
||||
InlineNamespace.runOver("inline namespace A {\n"
|
||||
" namespace B {\n"
|
||||
" class C {};\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"using namespace A::B;\n"
|
||||
"C c;\n",
|
||||
TypeNameVisitor::Lang_CXX11);
|
||||
|
||||
TypeNameVisitor AnonStrucs;
|
||||
AnonStrucs.ExpectedQualTypeNames["a"] = "short";
|
||||
AnonStrucs.ExpectedQualTypeNames["un_in_st_1"] =
|
||||
|
|
Loading…
Reference in New Issue