================
@@ -4515,6 +4515,57 @@ void Sema::DiagnoseExceptionUse(SourceLocation Loc, bool
IsTry) {
targetDiag(Loc, diag::err_exceptions_disabled) << (IsTry ? "try" :
"throw");
}
+// Walk the statement subtree and return the first statement that
+// contains a non-trivial C++ object that would require destruction at
+// scope exit, or nullptr if none was found.
+static const Stmt *findNonTrivialObject(Sema &S, const Stmt *Node) {
----------------
MuellerMP wrote:
I can not really argue about Sema since I'm less familiar with that code but
regarding a CodeGen fix: you can look up `EHScopeStack::pushCleanup`. This is
the single instance where `EmitSehCppScopeBegin` is called in the default
frontend (not CIR). If you check here for SEH personality (maybe reuse
`getSEHPersonalityMSVC`?) you can emit the diagnostic on the function defintion
sorta like this:
```c++
CGF->CGM.getDiags().Report(CGF->CurFuncDecl->getLocation(),
diag::the_correct_seh_diagnostic)
```
MSVC also just seems to emit the diagnostic on the function definition line. So
the handling would be conforming with the MSVC way.
https://github.com/llvm/llvm-project/pull/172287
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits