================
@@ -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) {
----------------
GkvJwa wrote:

I continued debugging it, SEH && object unwinding, When both conditions are 
present
EmitCXXTemporary -> pushDestroy(The fourth arg is destroyCXXObject)
```
clang::CodeGen::EHScopeStack::pushCleanup Line 209
 clang::CodeGen::EHScopeStack::pushCleanup  Line 293
  clang::CodeGen::CodeGenFunction::pushFullExprCleanup Line 912
   clang::CodeGen::CodeGenFunction::pushDestroy Line 2297
     clang::CodeGen::CodeGenFunction::EmitCXXTemporary Line 1343

void CodeGenFunction::EmitCXXTemporary(const CXXTemporary *Temporary,
                                       QualType TempType,
                                       Address Ptr) {
  pushDestroy(NormalAndEHCleanup, Ptr, TempType, destroyCXXObject,
              /*useEHCleanup*/ true);
}
```

This arg can be used to directly determine whether it's an object, but it's not 
passed in `pushCleanup`.
```
  template <class T, class... As> void pushCleanup(CleanupKind Kind, As... A) {
    static_assert(alignof(T) <= ScopeStackAlignment,
                  "Cleanup's alignment is too large.");
    void *Buffer = pushCleanup(Kind, sizeof(T));
    Cleanup *Obj = new (Buffer) T(A...); // here
    (void) Obj;
  }
```

This prevents us from checking directly, or we can check in EmitCXXTemporary to 
see if it's feasible?


https://github.com/llvm/llvm-project/pull/172287
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to