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

Michael Buch via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 21 04:23:15 PDT 2022


Michael137 added a comment.

In D130213#3668109 <https://reviews.llvm.org/D130213#3668109>, @werat wrote:

> 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?
>
> ---
>
>   ❯ bin/lldb --version
>   lldb version 15.0.0git (https://github.com/llvm/llvm-project.git revision 2feb99b02c886201c9774f4f24df14299105b321)
>     clang revision 2feb99b02c886201c9774f4f24df14299105b321
>     llvm revision 2feb99b02c886201c9774f4f24df14299105b321

Hmm odd, on my Darwin machine the test consistently crashes

Let me confirm


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