[PATCH] D56463: [SEH] Pass the frame pointer from SEH finally to finally functions

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 9 12:16:15 PST 2019


efriedma added a comment.

It's currently possible to write, in clang:

  void f() {
    __try {
    }
    __except(({__try{}__finally{}; 3;})) {
    }
  }

And the following currently crashes if you try to build it with clang:

  struct A { ~A(); };
  int f(const A&);
  void g() {
    __try {
    }
    __except(f(A())) {
    }
  }

But both of those should be rejected; it should be safe to assume it's impossible to have an __finally block inside a filter.

I think this looks fine, but I'd prefer if Reid could take a quick look.



================
Comment at: lib/CodeGen/CGException.cpp:1632
+    // If CFG.IsOutlinedSEHHelper is true, then we are within a finally block.
+    if (CGF.IsOutlinedSEHHelper)
+      FP = &CGF.CurFn->arg_begin()[1];
----------------
Please use braces consistently.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56463





More information about the cfe-commits mailing list