[PATCH] D41039: Add support for attribute "trivial_abi"

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 6 08:27:05 PST 2018


aaron.ballman added inline comments.


================
Comment at: include/clang/Basic/Attr.td:1159
+def TrivialABI : InheritableAttr {
+  let Spellings = [Clang<"trivial_abi">];
+  let Subjects = SubjectList<[CXXRecord]>;
----------------
Would this attribute make sense in C, or does it really only make sense in C++? If it doesn't make sense in C++, then you should also set `LangOpts` to be `CPlusPlus`. If it does make sense in C, then the Clang spelling should be `Clang<"trivial_abi", 1>`


================
Comment at: lib/Sema/SemaDeclCXX.cpp:7594
+  for (const auto &B : RD.bases()) {
+    CXXRecordDecl *BaseClassDecl
+        = cast<CXXRecordDecl>(B.getType()->getAs<RecordType>()->getDecl());
----------------
Can use `const auto *` here.


================
Comment at: lib/Sema/SemaDeclCXX.cpp:7640
+  // See if trivial_abi has to be dropped.
+  auto *RD = dyn_cast_or_null<CXXRecordDecl>(TagDecl);
+  if (RD && RD->hasAttr<TrivialABIAttr>())
----------------
This should use `dyn_cast` instead of `dyn_cast_or_null`.


https://reviews.llvm.org/D41039





More information about the cfe-commits mailing list