[PATCH] Delete CC_Default and use the target default CC everywhere

Richard Smith richard at metafoo.co.uk
Thu Aug 15 16:43:50 PDT 2013



================
Comment at: lib/AST/MangleNumberingContext.cpp:28
@@ -27,3 +27,3 @@
   QualType Key = Context.getFunctionType(Context.VoidTy, Proto->getArgTypes(),
-                                         FunctionProtoType::ExtProtoInfo());
+                                         Proto->getExtProtoInfo());
   Key = Context.getCanonicalType(Key);
----------------
Per http://mentorembedded.github.io/cxx-abi/abi.html#closure-types, we should only include the parameter types in the key here, not the calling convention or other parts of the EPI.

================
Comment at: lib/Sema/SemaLambda.cpp:830
@@ -827,3 +829,3 @@
   
-  FunctionProtoType::ExtProtoInfo ExtInfo;
+  FunctionProtoType::ExtProtoInfo ExtInfo = Proto->getExtProtoInfo();
   ExtInfo.TypeQuals = Qualifiers::Const;
----------------
This doesn't look right: the lambda's conversion operation shouldn't inherit properties from the lambda's call operator.

================
Comment at: lib/Sema/SemaLambda.cpp:899
@@ -896,3 +898,3 @@
   
-  FunctionProtoType::ExtProtoInfo ExtInfo;
+  FunctionProtoType::ExtProtoInfo ExtInfo = Proto->getExtProtoInfo();
   ExtInfo.TypeQuals = Qualifiers::Const;
----------------
Likewise.

================
Comment at: test/Sema/mrtd.c:3-19
@@ +2,18 @@
+
+void nonvariadic1(int a, int b, int c);
+void __attribute__((stdcall)) nonvariadic1(int a, int b, int c);
+
+void nonvariadic2(int a, int b, int c);
+void __attribute__((stdcall)) nonvariadic2(int a, int b, int c) { }
+
+void variadic(int a, ...); // expected-note {{previous declaration is here}}
+void __attribute__((stdcall)) variadic(int a, ...); // expected-error {{function declared 'stdcall' here was previously declared without calling convention}}
+
+extern void (*a)(int, int); // expected-note {{previous definition is here}}
+__attribute__((cdecl)) extern void (*a)(int, int); // expected-error {{redefinition of 'a' with a different type: 'void ((*))(int, int) __attribute__((cdecl))' vs 'void (*)(int, int) __attribute__((stdcall))'}}
+extern void (*b)(int, ...);
+__attribute__((cdecl)) extern void (*b)(int, ...);
+extern void (*c)(int, int);
+__attribute__((stdcall)) extern void (*c)(int, int);
+extern void (*d)(int, ...); // expected-note {{previous definition is here}}
+__attribute__((stdcall)) extern void (*d)(int, ...); // expected-error {{redefinition of 'd' with a different type: 'void ((*))(int, ...) __attribute__((stdcall))' vs 'void (*)(int, ...)'}}
----------------
It'd be useful to have a side-by-side test of this with and without `-mrtd`. (Maybe use one `RUN:` line with `-mrtd -DMRTD` and one without, and put the relevant `expected-foo`s in an `#ifdef MRTD`.)


http://llvm-reviews.chandlerc.com/D1231



More information about the cfe-commits mailing list