|
15 | 15 | #include "Plugins/TypeSystem/Swift/StoringDiagnosticConsumer.h" |
16 | 16 | #include "Plugins/ExpressionParser/Swift/SwiftPersistentExpressionState.h" |
17 | 17 |
|
| 18 | +#include "SwiftASTContext.h" |
18 | 19 | #include "TypeSystemSwift.h" |
19 | 20 | #include "TypeSystemSwiftTypeRef.h" |
20 | 21 | #include "lldb/Utility/Log.h" |
@@ -1800,11 +1801,18 @@ void SwiftASTContext::AddExtraClangArgs( |
1800 | 1801 | const std::vector<std::string> &module_search_paths, |
1801 | 1802 | const std::vector<std::pair<std::string, bool>> framework_search_paths, |
1802 | 1803 | StringRef overrideOpts) { |
| 1804 | + swift::ClangImporterOptions &importer_options = GetClangImporterOptions(); |
| 1805 | + auto defer = llvm::make_scope_exit([&]() { |
| 1806 | + // Detect explicitly-built modules. |
| 1807 | + m_has_explicit_modules = |
| 1808 | + llvm::any_of(importer_options.ExtraArgs, [](const std::string &arg) { |
| 1809 | + return StringRef(arg).starts_with("-fmodule-file="); |
| 1810 | + }); |
| 1811 | + }); |
| 1812 | + |
1803 | 1813 | if (ExtraArgs.empty()) |
1804 | 1814 | return; |
1805 | 1815 |
|
1806 | | - swift::ClangImporterOptions &importer_options = GetClangImporterOptions(); |
1807 | | - |
1808 | 1816 | // Detect cc1 flags. When DirectClangCC1ModuleBuild is on then the |
1809 | 1817 | // clang arguments in the serialized invocation are clang cc1 flags, |
1810 | 1818 | // which are very specific to one compiler version and cannot |
@@ -1835,12 +1843,6 @@ void SwiftASTContext::AddExtraClangArgs( |
1835 | 1843 | applyOverrideOptions(importer_options.ExtraArgs, overrideOpts); |
1836 | 1844 | if (HasNonexistentExplicitModule(importer_options.ExtraArgs)) |
1837 | 1845 | RemoveExplicitModules(importer_options.ExtraArgs); |
1838 | | - |
1839 | | - // Detect explicitly-built modules. |
1840 | | - m_has_explicit_modules = |
1841 | | - llvm::any_of(importer_options.ExtraArgs, [](const std::string &arg) { |
1842 | | - return StringRef(arg).starts_with("-fmodule-file="); |
1843 | | - }); |
1844 | 1846 | } |
1845 | 1847 |
|
1846 | 1848 | void SwiftASTContext::AddExtraClangCC1Args( |
@@ -5494,6 +5496,9 @@ void SwiftASTContext::LogConfiguration(bool is_repl) { |
5494 | 5496 | if (!clang_importer_options.BridgingHeader.empty()) |
5495 | 5497 | HEALTH_LOG_PRINTF(" Bridging Header : %s", |
5496 | 5498 | clang_importer_options.BridgingHeader.c_str()); |
| 5499 | + if (auto *expr_ctx = llvm::dyn_cast<SwiftASTContextForExpressions>(this)) |
| 5500 | + HEALTH_LOG_PRINTF(" Explicit modules : %s", |
| 5501 | + expr_ctx->HasExplicitModules() ? "true" : "false"); |
5497 | 5502 |
|
5498 | 5503 | HEALTH_LOG_PRINTF( |
5499 | 5504 | " Extra clang arguments : (%llu items)", |
|
0 commit comments