[PATCH] D101561: [Prototype] Introduce attribute for ignoring C++ ABI

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 29 12:08:19 PDT 2021


aeubanks created this revision.
Herald added a reviewer: aaron.ballman.
aeubanks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101561

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/lib/CodeGen/TargetInfo.cpp


Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -4204,6 +4204,8 @@
     if (RT->getDecl()->hasFlexibleArrayMember())
       return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
 
+    if (RT->getDecl()->hasAttr<UnstableABIAttr>())
+      return ABIArgInfo::getDirect();
   }
 
   const Type *Base = nullptr;
Index: clang/include/clang/Basic/AttrDocs.td
===================================================================
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -3150,6 +3150,12 @@
   }];
 }
 
+def UnstableABIDocs : Documentation {
+  let Category = DocCatDecl;
+  let Content = [{
+  }];
+}
+
 def MSInheritanceDocs : Documentation {
   let Category = DocCatDecl;
   let Heading = "__single_inhertiance, __multiple_inheritance, __virtual_inheritance";
Index: clang/include/clang/Basic/Attr.td
===================================================================
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -1538,6 +1538,16 @@
   let SimpleHandler = 1;
 }
 
+def UnstableABI : InheritableAttr {
+  // This attribute does not have a C [[]] spelling because it requires the
+  // CPlusPlus language option.
+  let Spellings = [Clang<"unstable_abi", 0>];
+  let Subjects = SubjectList<[CXXRecord]>;
+  let Documentation = [UnstableABIDocs];
+  let LangOpts = [CPlusPlus];
+  let SimpleHandler = 1;
+}
+
 def MaxFieldAlignment : InheritableAttr {
   // This attribute has no spellings as it is only ever created implicitly.
   let Spellings = [];


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101561.341601.patch
Type: text/x-patch
Size: 1661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210429/50264465/attachment.bin>


More information about the cfe-commits mailing list