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;
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;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits