[PATCH] D80344: [Windows SEH]: HARDWARE EXCEPTION HANDLING (MSVC -EHa) - Part 1

Ten Tzen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 15:56:48 PDT 2020


tentzen added a comment.

In D80344#2291926 <https://reviews.llvm.org/D80344#2291926>, @rjmccall wrote:

> Okay.  I think we're on the same page about representation now.  If you can come up with a good replacement for "eha" in the intrinsic names, I think this is pretty much ready to go.

how about seh.cppscope.begin() and seh.cppscope.end()? or any suggestion?

> This is a very emission-centric description of the intrinsic. Maybe something like:

Very good writing for LangRef.rst:-).  Will update it with your writing. Thanks!

As for pairing question, we simply utilizes existent Cleanup mechanism as you described in which abnormal exits and normal fall-through are merged in a 'cleanup' pad.  What this implementation does is to inject a scope.begin right after a ctor and a scope.end right before dtor in cleanup-pad.  Use the same example, it will be something like below:

  void test(int x, int &state) {
    int jumpdest;
    state = 0;
    std::string a;  
    **seh.cppscope.begin();  // for object a**
    state = 1;
    if (x > 0) {
      state = 2;
      std::string b;
      **seh.cppscope.begin();  // for b**
      state = 3;
      if (x > 10) {
        state = 4;
        jumpdest = 0;
        goto destroy_b;
      }
      state = 5;
      std::string c;
      **seh.cppscope.begin();  // for c**
      state = 6;
      **seh.cppscope.end(); // for c dtor**
      c.~std::string();
      jumpdest = 1;
    destroy_b:
      **seh.cppscope.end();   // for b dtor**
      b.~std::string();
      switch (jumpdest) {
      case 0: goto destroy_a;
      case 1: goto fallthrough;
      }
    fallthrough:
      ;
    }
    state = 7;
  destroy_a:
    **seh.cppscope.begin();  // for a dtor **
    a.~std::string();
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80344



More information about the llvm-commits mailing list