[PATCH] D17214: Stop using "template" when printing qualtype names

Sterling Augustine via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 12 13:56:18 PST 2016


saugustine created this revision.
saugustine added a reviewer: rsmith.
saugustine added subscribers: cfe-commits, klimek.

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.

http://reviews.llvm.org/D17214

Files:
  lib/Tooling/Core/QualTypeNames.cpp
  unittests/Tooling/QualTypeNamesTest.cpp

Index: unittests/Tooling/QualTypeNamesTest.cpp
===================================================================
--- unittests/Tooling/QualTypeNamesTest.cpp
+++ unittests/Tooling/QualTypeNamesTest.cpp
@@ -85,7 +85,8 @@
   // Namespace alias
   Visitor.ExpectedQualTypeNames["CheckL"] = "A::B::C::MyInt";
   Visitor.ExpectedQualTypeNames["non_dependent_type_var"] =
-      "template Foo<X>::non_dependent_type";
+      "Foo<X>::non_dependent_type";
+  Visitor.ExpectedQualTypeNames["AnEnumVar"] = "EnumScopeClass::AnEnum";
   Visitor.runOver(
       "int CheckInt;\n"
       "namespace A {\n"
@@ -143,6 +144,11 @@
       "  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;
Index: lib/Tooling/Core/QualTypeNames.cpp
===================================================================
--- lib/Tooling/Core/QualTypeNames.cpp
+++ lib/Tooling/Core/QualTypeNames.cpp
@@ -329,7 +329,8 @@
 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17214.47854.patch
Type: text/x-patch
Size: 1591 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160212/c75bb457/attachment.bin>


More information about the cfe-commits mailing list