[PATCH] D102027: [SEH] Fix regression with SEH in noexpect functions

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 7 13:29:08 PDT 2021


rnk added a comment.

I went ahead and implemented my suggested changes and pushed this with attribution. Thanks for the fix!



================
Comment at: clang/lib/CodeGen/CGException.cpp:1966
 
   StartFunction(GlobalDecl(), RetTy, Fn, FnInfo, Args,
                 OutlinedStmt->getBeginLoc(), OutlinedStmt->getBeginLoc());
----------------
I think passing `GlobalDecl()` here is intentional, there must have been some reason to have the helper CGF have a null function. This noexcept thing seems like one such example.


================
Comment at: clang/lib/CodeGen/CGExpr.cpp:4188
 LValue CodeGenFunction::EmitLValueForLambdaField(const FieldDecl *Field) {
-  assert(cast<CXXMethodDecl>(CurCodeDecl)->getParent()->isLambda());
-  assert(cast<CXXMethodDecl>(CurCodeDecl)->getParent() == Field->getParent());
+  assert(IsOutlinedSEHHelper || cast<CXXMethodDecl>(CurCodeDecl)->getParent()->isLambda());
+  assert(IsOutlinedSEHHelper || cast<CXXMethodDecl>(CurCodeDecl)->getParent() == Field->getParent());
----------------
Other uses of CurCodeDecl check it for null, so I think it makes sense to go ahead and do the same here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102027/new/

https://reviews.llvm.org/D102027



More information about the cfe-commits mailing list