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

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 9 00:12:59 PST 2018


ahatanak marked 7 inline comments as done.
ahatanak added inline comments.


================
Comment at: lib/Sema/SemaDecl.cpp:11700
+    }
+  }
+
----------------
rsmith wrote:
> rjmccall wrote:
> > I think it's correct not to call CheckDestructorAccess and DiagnoseUseOfDecl here, since according to the standard destructor access is always supposed to be checked at the call-site, but please leave a comment explaining that.
> The corresponding code for `areArgsDestroyedLeftToRightInCallee` is in `SemaChecking`. This should be done in the same place.
> 
> More generally, we have at least three different places where we check `CXXABI::areArgsDestroyedLeftToRightInCallee() || Type->hasTrivialABIOverride()`. It would make sense to factor that out into a `isParamDestroyedInCallee` function (probably on `ASTContext`, since we don't have anywhere better for ABI-specific checks at a layering level that can talk about types).
I defined function ASTContext::isParamDestroyedInCallee and used it in two places. I didn't use it in CodeGenFunction::EmitParmDecl because the destructor cleanup is pushed only when the argument is passed indirectly in MSVC's case, whereas it is always pushed when the class is HasTrivialABIOverride.


================
Comment at: lib/Sema/SemaDeclCXX.cpp:7580
 
+static void checkIllFormedTrivialABIStruct(CXXRecordDecl &RD, Sema &S) {
+  auto PrintDiagAndRemoveAttr = [&]() {
----------------
rsmith wrote:
> Either "ill-formed" is the wrong word here, or this needs to produce `ext_` diagnostics that `-pedantic-errors` turns into hard errors.
I made the warning derive from ExtWarn.


https://reviews.llvm.org/D41039





More information about the cfe-commits mailing list