[PATCH] D17893: Sema: Add semantic analysis for the C++ ABI stability attributes and whitelist.

John McCall via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 18 13:37:58 PDT 2016


rjmccall added inline comments.

================
Comment at: lib/Sema/SemaDeclCXX.cpp:4935-4943
@@ +4934,11 @@
+
+  bool HasStableAttr = Record->hasAttr<StableABIAttr>();
+  bool HasUnstableAttr = Record->hasAttr<UnstableABIAttr>();
+  if (HasStableAttr && HasUnstableAttr) {
+    Diag(Record->getLocation(), diag::err_abi_mismatch) << Record;
+    Diag(Record->getAttr<StableABIAttr>()->getLocation(),
+         diag::note_abi_stability_attr) << /*Unstable=*/false;
+    Diag(Record->getAttr<UnstableABIAttr>()->getLocation(),
+         diag::note_abi_stability_attr) << /*Unstable=*/true;
+  }
+
----------------
pcc wrote:
> rjmccall wrote:
> > No, ms_struct is a request for a specific ABI; this would be a conflict.
> Fair point. I think we can handle this by making `ms_struct` imply `stable_abi` in the same way that `uuid` would imply `stable_abi`. Then there would be a conflict between `ms_struct` and `unstable_abi`, and we would infer the correct ABI in implied namespaces.
> 
> Are there any other attributes like that? I could only find `vecreturn` and `novtable`.
I can't think of anything else that's a conflict.  vecreturn affects a different aspect of the ABI.  novtable is advisory and orthogonal.  Alignment/packed attributes should still be honored under an unstable ABI.


http://reviews.llvm.org/D17893





More information about the cfe-commits mailing list