[Lldb-commits] [PATCH] D130213: [LLDB][ClangExpression] Fix initialization of static enum alias members

Andy Yankovsky via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 21 04:07:14 PDT 2022


werat added a comment.

I've tried reproducing the test case with `lldb` built from HEAD on my Linux machine and it seems to work without your patch:

  ❯ cat ~/src/cpp/const.cc 
  enum class ScopedEnum {
    scoped_enum_case1 = 1,
    scoped_enum_case2 = 2,
  };
  
  struct A {
    using EnumAlias = ScopedEnum;
    static constexpr EnumAlias e = ScopedEnum::scoped_enum_case2;
  };
  
  int main() {
      auto enum_alias_val = A::e;
  }
  
  ❯ bin/lldb ~/src/cpp/a.out
  (lldb) target create "/home/werat/src/cpp/a.out"
  Current executable set to '/home/werat/src/cpp/a.out' (x86_64).
  (lldb) b main
  Breakpoint 1: where = a.out`main + 4 at const.cc:12:10, address = 0x0000000000401114
  (lldb) r
  Process 2767509 launched: '/home/werat/src/cpp/a.out' (x86_64)
  Process 2767509 stopped
  * thread #1, name = 'a.out', stop reason = breakpoint 1.1
      frame #0: 0x0000000000401114 a.out`main at const.cc:12:10
     9    };
     10  
     11   int main() {
  -> 12       auto enum_alias_val = A::e;
     13   }
  (lldb) p A::e
  (const A::EnumAlias) $0 = scoped_enum_case2

Maybe the test case doesn't actually hit the problem you're trying to address?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130213



More information about the lldb-commits mailing list