[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
Tue Jan 5 03:22:31 PST 2021


werat created this revision.
Herald added a subscriber: arphaman.
werat requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Add unscoped enumeration members to the "globals" manual dwarf index. This
effectively makes them discoverable as global variables (which they
essentially are).

Before expression evaluator failed to lookup enumerators unless the
enumeration type has been already completed.

Consider the example:

  enum MyEnum { eFoo = 1 };
  MyEnum my_enum = eFoo;

(lldb) p eFoo
error: <user expression 2>:1:1: use of undeclared identifier 'eFoo'
eFirst
^
(lldb) p my_enum + eFoo
(int) $0 = 2

With this patch all unscoped enumerators can be looked up same as the global
variables and the expression evaluation works as expected.
`SBTarget::FindGlobalVariables()` now returns unscoped enumerators as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94077

Files:
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/test/API/lang/cpp/enum_types/TestCPP11EnumTypes.py
  lldb/test/API/lang/cpp/enum_types/main.cpp
  lldb/test/API/python_api/target/globals/Makefile
  lldb/test/API/python_api/target/globals/TestTargetGlobals.py
  lldb/test/API/python_api/target/globals/main.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94077.314557.patch
Type: text/x-patch
Size: 9796 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210105/0e81808c/attachment.bin>


More information about the lldb-commits mailing list