[Lldb-commits] [PATCH] D61565: Ignore generated @import statements in the expression evaluator to fix import-std-module tests on macOS

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue May 7 09:16:48 PDT 2019


aprantl added a comment.

A slightly more elegant solution might be to inject a #line directive that changes to a different source file for the code that the user entered. I've been long wanting to make `expr -g` more palatable to end users by hiding the LLDB-injected code in a separate source file by default. If that turns out to be too much work, feel free to land this version.



================
Comment at: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:111
+  // True iff the parser has entered or passed the actual user expression.
+  // False means the parser is still parsing the wrapper code generated by LLDB.
+  bool m_entered_expr = false;
----------------
`///`


================
Comment at: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:141
+    // loaded by the user. We can stop here as we only care about user-loaded
+    // modules.
+    if (!m_entered_expr)
----------------
Just to make sure I'm understanding:

`expr @import Foo` will still work, but it will import Foo into the expression rather than into the context from which we ASTImport definitions?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61565





More information about the lldb-commits mailing list