[PATCH] D71962: Fix crash in getFullyQualifiedName for inline namespace
Alexey Bader via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 28 08:43:49 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rG128f39da932b: Fix crash in getFullyQualifiedName for inline namespace (authored by bader).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71962/new/
https://reviews.llvm.org/D71962
Files:
clang/lib/AST/QualTypeNames.cpp
clang/unittests/Tooling/QualTypeNamesTest.cpp
Index: clang/unittests/Tooling/QualTypeNamesTest.cpp
===================================================================
--- clang/unittests/Tooling/QualTypeNamesTest.cpp
+++ clang/unittests/Tooling/QualTypeNamesTest.cpp
@@ -223,6 +223,17 @@
"}\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"] =
Index: clang/lib/AST/QualTypeNames.cpp
===================================================================
--- clang/lib/AST/QualTypeNames.cpp
+++ clang/lib/AST/QualTypeNames.cpp
@@ -192,7 +192,7 @@
// 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71962.235478.patch
Type: text/x-patch
Size: 1352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191228/85da6129/attachment.bin>
More information about the cfe-commits
mailing list