- Finish hooking up support for __builtin_types_compatible_p().
- Fix type printing code for recently added TypeOfExpr/TypeOfType.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40700 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/Type.cpp b/AST/Type.cpp
index 63a681a..2ef457e 100644
--- a/AST/Type.cpp
+++ b/AST/Type.cpp
@@ -654,15 +654,19 @@
 }
 
 void TypeOfExpr::getAsStringInternal(std::string &InnerString) const {
+  if (!InnerString.empty())    // Prefix the basic type, e.g. 'typeof(e) X'.
+    InnerString = ' ' + InnerString;
   std::ostringstream s;
   getUnderlyingExpr()->print(s);
   InnerString = "typeof(" + s.str() + ") " + InnerString;
 }
 
-void TypeOfType::getAsStringInternal(std::string &S) const {
+void TypeOfType::getAsStringInternal(std::string &InnerString) const {
+  if (!InnerString.empty())    // Prefix the basic type, e.g. 'typeof(t) X'.
+    InnerString = ' ' + InnerString;
   std::string Tmp;
   getUnderlyingType().getAsStringInternal(Tmp);
-  S += "typeof(" + Tmp + ")";
+  InnerString = "typeof(" + Tmp + ")" + InnerString;
 }
 
 void FunctionTypeNoProto::getAsStringInternal(std::string &S) const {