r292194 - [AST] AttributedType should derive type properties from the EquivalentType

David Majnemer via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 16 20:14:25 PST 2017


Author: majnemer
Date: Mon Jan 16 22:14:25 2017
New Revision: 292194

URL: http://llvm.org/viewvc/llvm-project?rev=292194&view=rev
Log:
[AST] AttributedType should derive type properties from the EquivalentType

Using the canonical type instead of the equivalent type can result in
insufficient template instantiations.

This fixes PR31656.

Differential Revision: https://reviews.llvm.org/D28788

Modified:
    cfe/trunk/include/clang/AST/Type.h
    cfe/trunk/test/CodeGenCXX/microsoft-abi-default-cc.cpp

Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=292194&r1=292193&r2=292194&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Mon Jan 16 22:14:25 2017
@@ -3832,13 +3832,13 @@ private:
 
   friend class ASTContext; // creates these
 
-  AttributedType(QualType canon, Kind attrKind,
-                 QualType modified, QualType equivalent)
-    : Type(Attributed, canon, canon->isDependentType(),
-           canon->isInstantiationDependentType(),
-           canon->isVariablyModifiedType(),
-           canon->containsUnexpandedParameterPack()),
-      ModifiedType(modified), EquivalentType(equivalent) {
+  AttributedType(QualType canon, Kind attrKind, QualType modified,
+                 QualType equivalent)
+      : Type(Attributed, canon, equivalent->isDependentType(),
+             equivalent->isInstantiationDependentType(),
+             equivalent->isVariablyModifiedType(),
+             equivalent->containsUnexpandedParameterPack()),
+        ModifiedType(modified), EquivalentType(equivalent) {
     AttributedTypeBits.AttrKind = attrKind;
   }
 

Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-default-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-default-cc.cpp?rev=292194&r1=292193&r2=292194&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-default-cc.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-default-cc.cpp Mon Jan 16 22:14:25 2017
@@ -45,3 +45,12 @@ void __cdecl static_baz() {}
 void static_qux() {}
 // GCABI-LABEL: define void @_Z10static_quxv
 // MSABI: define void @"\01?static_qux@@YAXXZ"
+
+namespace PR31656 {
+template <int I>
+void __cdecl callee(int args[I]);
+// GCABI-LABEL: declare void @_ZN7PR316566calleeILi1EEEvPi(
+// MSABI: declare void @"\01??$callee@$00 at PR31656@@YAXQAH at Z"(
+
+void caller() { callee<1>(0); }
+}




More information about the cfe-commits mailing list