[Lldb-commits] [PATCH] D94077: Support unscoped enumeration members in the expression evaluator.

Andy Yankovsky via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 8 02:14:19 PST 2021

werat added a comment.

In D94077#2479984 <https://reviews.llvm.org/D94077#2479984>, @shafik wrote:

> We can have unscoped enums in namespace and class scope and the enumerators won't leak out from those scopes. Thus we can have shadowing going on e.g.:
> ...
> How does this change deal with those cases?

Thanks for pointing this out! My first patch didn't really take this into account, so it didn't work properly. I've made some changes to make it work, although I'm not very familiar with these parts of LLDB yet, so I'm not sure whether this approach is how it should be implemented.

Also I've noticed that LLDB's expression evaluator is not perfect with these lookups, e.g. it can find global variables from other scopes if there's no better candidate (not sure if this is a bug of a feature):

  Process 3768045 stopped
  * thread #1, name = 'a.out', stop reason = breakpoint 1.1
      frame #0: 0x0000000000401116 a.out`main at global.cpp:2:13
     1    namespace Foo { int x = 1; }
  -> 2    int main() {};
  (lldb) p x
  (int) $0 = 1

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list