[all-commits] [llvm/llvm-project] 1cbcf7: [lldb][ClangExpressionParser] Set BuiltinHeadersIn...
Michael Buch via All-commits
all-commits at lists.llvm.org
Wed Aug 7 16:00:19 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1cbcf74083e92021472ec9644b88418f377ce550
https://github.com/llvm/llvm-project/commit/1cbcf74083e92021472ec9644b88418f377ce550
Author: Michael Buch <michaelbuch12 at gmail.com>
Date: 2024-08-07 (Wed, 07 Aug 2024)
Changed paths:
M lldb/include/lldb/Utility/XcodeSDK.h
M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
M lldb/source/Utility/XcodeSDK.cpp
Log Message:
-----------
[lldb][ClangExpressionParser] Set BuiltinHeadersInSystemModules depending on SDK version (#102309)
This patch changes the way we initialize `BuiltinHeadersInSystemModules`
which is one of the flags controlling Clang's behaviour when the Darwin
module is split into more fine-grained modules. The
ClangExpressionParser currently unconditionally sets
`-fbuiltin-headers-in-system-modules` when evaluating expressions with
the `target.import-std-module` setting. This flag should, however, be
set depending on the SDK version (which is what the Clang Darwin
toolchain does).
Unfortunately, the compiler instance that we create with
`ClangExpressionParser` never consults the Clang driver, and thus
doesn't correctly infer `BuiltinHeadersInSystemModules`. Note, this
isn't an issue with the `CompilerInstance` that the
`ClangModulesDeclVendor` creates because it uses the `createInovcation`
API, which calls into `Darwin::addClangTargetOptions`.
This patch mimicks how `sdkSupportsBuiltinModules` is used in
`Darwin::addClangTargetOptions`.
This ensures that the `import-std-module` API tests run cleanly
regardless of SDK version.
The plan is to eventually make the `CompilerInstance` construction in
`ClangExpressionParser` go through the driver, so we can avoid
duplicating the logic in LLDB. But we aren't there yet.
**Implementation**
* We look for the `SDKSettings.json` in the sysroot directory that we
found in DWARF (via `DW_AT_LLVM_sysroot`)
* Then parse this file and extract the SDK version number out of it
* Then mimick `sdkSupportsBuiltinModules` from `Toolchains/Darwin.cpp`
and set `BuiltinHeadersInSystemModules` based on it
rdar://116490281
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list