]> granicus.if.org Git - clang/commitdiff
When comparing two calling conventions after redeclaring a function, compare
authorCharles Davis <cdavis@mines.edu>
Tue, 23 Feb 2010 06:13:55 +0000 (06:13 +0000)
committerCharles Davis <cdavis@mines.edu>
Tue, 23 Feb 2010 06:13:55 +0000 (06:13 +0000)
the canonical calling conventions instead of comparing the raw calling
conventions directly. Fixes PR6361.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96895 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaType.cpp
test/Sema/callingconv.c

index adfe6cd7d9c401353e22a037287d1b77cd00053f..f5e6bef7198e0a08a49e680e5db3d0c6bc91041c 100644 (file)
@@ -1755,7 +1755,8 @@ bool ProcessFnAttr(Sema &S, QualType &Type, const AttributeList &Attr) {
   }
 
   CallingConv CCOld = Fn->getCallConv();
-  if (CC == CCOld) return false;
+  if (S.Context.getCanonicalCallConv(CC) ==
+      S.Context.getCanonicalCallConv(CCOld)) return false;
 
   if (CCOld != CC_Default) {
     // Should we diagnose reapplications of the same convention?
index 0752606ed908674247237aaafbff9df5b1601cd5..424db751b64b2da21ca4ca2e84af79c2924c8c7c 100644 (file)
@@ -36,3 +36,7 @@ void (__attribute__((cdecl)) *pctest2)() = ctest2;
 typedef void (__attribute__((fastcall)) *Handler) (float *);
 Handler H = foo;
 
+// PR6361
+void ctest3();
+void __attribute__((cdecl)) ctest3() {}
+