Use the power of types to track down another canonicalization bug in
the ABI-computation interface.  Fixes <rdar://problem/7691046>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97197 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGCall.h b/lib/CodeGen/CGCall.h
index 1d1b8ee..3d81165 100644
--- a/lib/CodeGen/CGCall.h
+++ b/lib/CodeGen/CGCall.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/Value.h"
 #include "clang/AST/Type.h"
+#include "clang/AST/CanonicalType.h"
 
 #include "CGValue.h"
 
@@ -57,7 +58,7 @@
   /// function definition.
   class CGFunctionInfo : public llvm::FoldingSetNode {
     struct ArgInfo {
-      QualType type;
+      CanQualType type;
       ABIArgInfo info;
     };
 
@@ -81,8 +82,8 @@
 
     CGFunctionInfo(unsigned CallingConvention,
                    bool NoReturn,
-                   QualType ResTy,
-                   const llvm::SmallVectorImpl<QualType> &ArgTys);
+                   CanQualType ResTy,
+                   const llvm::SmallVectorImpl<CanQualType> &ArgTys);
     ~CGFunctionInfo() { delete[] Args; }
 
     const_arg_iterator arg_begin() const { return Args + 1; }
@@ -107,7 +108,7 @@
       EffectiveCallingConvention = Value;
     }
 
-    QualType getReturnType() const { return Args[0].type; }
+    CanQualType getReturnType() const { return Args[0].type; }
 
     ABIArgInfo &getReturnInfo() { return Args[0].info; }
     const ABIArgInfo &getReturnInfo() const { return Args[0].info; }
@@ -123,14 +124,16 @@
     static void Profile(llvm::FoldingSetNodeID &ID,
                         unsigned CallingConvention,
                         bool NoReturn,
-                        QualType ResTy,
+                        CanQualType ResTy,
                         Iterator begin,
                         Iterator end) {
       ID.AddInteger(CallingConvention);
       ID.AddBoolean(NoReturn);
       ResTy.Profile(ID);
-      for (; begin != end; ++begin)
-        begin->Profile(ID);
+      for (; begin != end; ++begin) {
+        CanQualType T = *begin; // force iterator to be over canonical types
+        T.Profile(ID);
+      }
     }
   };