[PATCH] D19253: [Tooling] Fix getting fully qualified names of template alias types.
Chaoren Lin via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 20 15:17:55 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL266925: [Tooling] Fix getting fully qualified names of template alias types. (authored by chaoren).
Changed prior to commit:
http://reviews.llvm.org/D19253?vs=54225&id=54435#toc
Repository:
rL LLVM
http://reviews.llvm.org/D19253
Files:
cfe/trunk/lib/Tooling/Core/QualTypeNames.cpp
cfe/trunk/unittests/Tooling/QualTypeNamesTest.cpp
Index: cfe/trunk/lib/Tooling/Core/QualTypeNames.cpp
===================================================================
--- cfe/trunk/lib/Tooling/Core/QualTypeNames.cpp
+++ cfe/trunk/lib/Tooling/Core/QualTypeNames.cpp
@@ -304,6 +304,8 @@
Decl = TDT->getDecl();
} else if (const auto *TagDeclType = dyn_cast<TagType>(TypePtr)) {
Decl = TagDeclType->getDecl();
+ } else if (const auto *TST = dyn_cast<TemplateSpecializationType>(TypePtr)) {
+ Decl = TST->getTemplateName().getAsTemplateDecl();
} else {
Decl = TypePtr->getAsCXXRecordDecl();
}
Index: cfe/trunk/unittests/Tooling/QualTypeNamesTest.cpp
===================================================================
--- cfe/trunk/unittests/Tooling/QualTypeNamesTest.cpp
+++ cfe/trunk/unittests/Tooling/QualTypeNamesTest.cpp
@@ -87,13 +87,19 @@
Visitor.ExpectedQualTypeNames["non_dependent_type_var"] =
"Foo<X>::non_dependent_type";
Visitor.ExpectedQualTypeNames["AnEnumVar"] = "EnumScopeClass::AnEnum";
+ Visitor.ExpectedQualTypeNames["AliasTypeVal"] = "A::B::C::InnerAlias<int>";
Visitor.runOver(
"int CheckInt;\n"
+ "template <typename T>\n"
+ "class OuterTemplateClass { };\n"
"namespace A {\n"
" namespace B {\n"
" class Class0 { };\n"
" namespace C {\n"
" typedef int MyInt;"
+ " template <typename T>\n"
+ " using InnerAlias = OuterTemplateClass<T>;\n"
+ " InnerAlias<int> AliasTypeVal;\n"
" }\n"
" template<class X, class Y> class Template0;"
" template<class X, class Y> class Template1;"
@@ -148,7 +154,8 @@
"public:\n"
" enum AnEnum { ZERO, ONE };\n"
"};\n"
- "EnumScopeClass::AnEnum AnEnumVar;\n"
+ "EnumScopeClass::AnEnum AnEnumVar;\n",
+ TypeNameVisitor::Lang_CXX11
);
TypeNameVisitor Complex;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19253.54435.patch
Type: text/x-patch
Size: 1859 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160420/2c601850/attachment.bin>
More information about the cfe-commits
mailing list