rnk added a subscriber: rnk.

================
Comment at: include/clang/Sema/Sema.h:2938
@@ -2937,2 +2937,3 @@
   bool CheckRegparmAttr(const AttributeList &attr, unsigned &value);
+  bool getCCFromAttr(const AttributeList &attr, CallingConv &CC);
   bool CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC, 
----------------
Rather than adding this extra entry point, I think it would be simpler to 
extend CheckCallingConvAttr to return whatever extra info we need.

Besides, this new entry point also emits diagnostics, and it has a name that 
suggests it will not emit diagnostics.

================
Comment at: lib/Sema/SemaType.cpp:5866
@@ -5865,3 +5865,3 @@
   CallingConv CC;
   if (S.CheckCallingConvAttr(attr, CC))
     return true;
----------------
Right, we've already done the work that you are doing down below. We should 
just get what we needed to know out of here and pass it on.

================
Comment at: lib/Sema/SemaType.cpp:5925-5926
@@ +5924,4 @@
+      S.Context.getTargetInfo().checkCallingConvention(RawCC);
+  // If calling convention is available (CCCR_OK) or default (CCCR_Ignored), 
add
+  // it to type.
+  if (CCResult != TargetInfo::CCCR_Warning)
----------------
At a high level, why would you want to not create an AttributedType here? That 
seems desirable, the user wrote the type attribute in the source, and that 
should be reflected in the AST sugar.

If adding this sugar causes assertions later, then the bug must be somewhere 
else.

================
Comment at: test/CodeGen/adding_defaulted_attr_to_type.c:5
@@ +4,2 @@
+
+// CHECK: @f = common global void (i32)*
----------------
You can add more tests. I noticed this crashes for me:
  void (__attribute__((regparm(2), stdcall)) foo)(int);
That seems like a good one to add.

You can also rerun the test with i686-unknown-linux-gnu and #ifdefs to see that 
we accept the convention as desired on 32-bit.




http://reviews.llvm.org/D15373



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to