From: Reid Kleckner Date: Tue, 16 Feb 2016 20:34:27 +0000 (+0000) Subject: Stop using "template" when printing qualtype names X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7200698a6391999b856a3bb6f008164bb3d27168;p=clang Stop using "template" when printing qualtype names Summary: The keyword "template" isn't necessary when printing a fully-qualified qualtype name, and, in fact, results in a syntax error if one tries to use it. So stop printing it. Reviewers: rsmith, rnk Subscribers: rnk, klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D17214 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261005 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Tooling/Core/QualTypeNames.cpp b/lib/Tooling/Core/QualTypeNames.cpp index 2ff6bad406..02773be2a1 100644 --- a/lib/Tooling/Core/QualTypeNames.cpp +++ b/lib/Tooling/Core/QualTypeNames.cpp @@ -329,7 +329,8 @@ NestedNameSpecifier *createNestedNameSpecifier( NestedNameSpecifier *createNestedNameSpecifier( const ASTContext &Ctx, const TypeDecl *TD, bool FullyQualify) { return NestedNameSpecifier::Create(Ctx, createOuterNNS(Ctx, TD, FullyQualify), - true /*Template*/, TD->getTypeForDecl()); + false /*No TemplateKeyword*/, + TD->getTypeForDecl()); } /// \brief Return the fully qualified type, including fully-qualified diff --git a/unittests/Tooling/QualTypeNamesTest.cpp b/unittests/Tooling/QualTypeNamesTest.cpp index 889c525231..d7e7de52e8 100644 --- a/unittests/Tooling/QualTypeNamesTest.cpp +++ b/unittests/Tooling/QualTypeNamesTest.cpp @@ -85,7 +85,8 @@ TEST(QualTypeNameTest, getFullyQualifiedName) { // Namespace alias Visitor.ExpectedQualTypeNames["CheckL"] = "A::B::C::MyInt"; Visitor.ExpectedQualTypeNames["non_dependent_type_var"] = - "template Foo::non_dependent_type"; + "Foo::non_dependent_type"; + Visitor.ExpectedQualTypeNames["AnEnumVar"] = "EnumScopeClass::AnEnum"; Visitor.runOver( "int CheckInt;\n" "namespace A {\n" @@ -143,6 +144,11 @@ TEST(QualTypeNameTest, getFullyQualifiedName) { " var.dependent_type_var = 0;\n" "var.non_dependent_type_var = 0;\n" "}\n" + "class EnumScopeClass {\n" + "public:\n" + " enum AnEnum { ZERO, ONE };\n" + "};\n" + "EnumScopeClass::AnEnum AnEnumVar;\n" ); TypeNameVisitor Complex;