Skip to content

Commit 466ea89

Browse files
committed
[lldb] Fix failures when evaluating C++ expression and loading modules
This patch tentatively fixes the various test failures introduced following 0ea3d88: https://green.lab.llvm.org/green/view/LLDB/job/as-lldb-cmake/6316/ From my understanding, the main issue here is that we can't find some headers when evaluating C++ expressions since those headers have been promoted to be system modules, and to be shipped as part of the toolchain. Prior to 0ea3d88, the `BuiltinHeadersInSystemModules` flag for in the clang `LangOpts` struct was always set, however, after it landed, the flag becomes opt-in, depending on toolchain that is used with the compiler instance. This gets set in `clang::createInvocation` down to `Darwin::addClangTargetOptions`, as this is used mostly on Apple platforms. However, since `ClangExpressionParser` makes a dummy `CompilerInstance`, and sets the various language options arbitrarily, instead of using the `clang::createInvocation`, the flag remains unset, which causes the various error messages: ``` AssertionError: 'error: module.modulemap:96:11: header 'stdarg.h' not found 96 | header "stdarg.h" // note: supplied by the compiler | ^ ``` Given that this flag was opt-out previously, this patch brings back that behavior by setting it in lldb's `ClangExpressionParser` constructor, until we actually decide to pull the language options from the compiler driver. Signed-off-by: Med Ismail Bennani <[email protected]>
1 parent 8d20310 commit 466ea89

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,7 @@ ClangExpressionParser::ClangExpressionParser(
575575
lang_opts.GNUMode = true;
576576
lang_opts.GNUKeywords = true;
577577
lang_opts.CPlusPlus11 = true;
578+
lang_opts.BuiltinHeadersInSystemModules = true;
578579

579580
// The Darwin libc expects this macro to be set.
580581
lang_opts.GNUCVersion = 40201;

0 commit comments

Comments
 (0)