Add support for PrintingPolicy::SuppressTypeSpecifiers to type printing.  
(I have a work-in-progress patch which uses this.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72598 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 64433cd..e63e12b 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -896,6 +896,19 @@
   return false;
 }
 
+bool Type::isSpecifierType() const {
+  // Note that this intentionally does not use the canonical type.
+  switch (getTypeClass()) {
+  case Builtin:
+  case Record:
+  case Enum:
+  case Typedef:
+    return true;
+  default:
+    return false;
+  }
+}
+
 const char *BuiltinType::getName(bool CPlusPlus) const {
   switch (getKind()) {
   default: assert(0 && "Unknown builtin type!");
@@ -1144,7 +1157,10 @@
     S += "NULL TYPE";
     return;
   }
-  
+
+  if (Policy.SuppressTypeSpecifiers && getTypePtr()->isSpecifierType())
+    return;
+
   // Print qualifiers as appropriate.
   if (unsigned Tq = getCVRQualifiers()) {
     std::string TQS;
@@ -1371,9 +1387,11 @@
   
   S += "(";
   std::string Tmp;
+  PrintingPolicy ParamPolicy(Policy);
+  ParamPolicy.SuppressTypeSpecifiers = false;
   for (unsigned i = 0, e = getNumArgs(); i != e; ++i) {
     if (i) S += ", ";
-    getArgType(i).getAsStringInternal(Tmp, Policy);
+    getArgType(i).getAsStringInternal(Tmp, ParamPolicy);
     S += Tmp;
     Tmp.clear();
   }