Skip to content

Commit e7c38ef

Browse files
committed
Factor out LangOpt initialization
1 parent 1f4accf commit e7c38ef

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,9 @@ SwiftASTContext::SwiftASTContext(std::string description,
979979
// Set the clang modules cache path.
980980
m_compiler_invocation_ap->setClangModuleCachePath(
981981
GetClangModulesCacheProperty());
982+
}
982983

984+
void SwiftASTContext::SetCompilerInvocationLLDBOverrides() {
983985
swift::IRGenOptions &ir_gen_opts =
984986
m_compiler_invocation_ap->getIRGenOptions();
985987
ir_gen_opts.OutputKind = swift::IRGenOutputKind::Module;
@@ -1964,6 +1966,8 @@ SwiftASTContext::CreateInstance(lldb::LanguageType language, Module &module,
19641966
ConfigureResourceDirs(swift_ast_sp->GetCompilerInvocation(), resource_dir,
19651967
triple);
19661968

1969+
swift_ast_sp->SetCompilerInvocationLLDBOverrides();
1970+
19671971
// Apply the working directory to all relative paths.
19681972
std::vector<std::string> DeserializedArgs = swift_ast_sp->GetClangArguments();
19691973
swift_ast_sp->GetClangImporterOptions().ExtraArgs.clear();
@@ -2490,6 +2494,8 @@ lldb::TypeSystemSP SwiftASTContext::CreateInstance(
24902494
// otherwise no modules will be found.
24912495
swift_ast_sp->InitializeSearchPathOptions(module_search_paths,
24922496
framework_search_paths);
2497+
swift_ast_sp->SetCompilerInvocationLLDBOverrides();
2498+
24932499
if (!swift_ast_sp->GetClangImporter()) {
24942500
logError("couldn't create a ClangImporter");
24952501
return {};
@@ -2771,6 +2777,8 @@ lldb::TypeSystemSP SwiftASTContext::CreateInstance(
27712777
// otherwise no modules will be found.
27722778
swift_ast_sp->InitializeSearchPathOptions(module_search_paths,
27732779
framework_search_paths);
2780+
swift_ast_sp->SetCompilerInvocationLLDBOverrides();
2781+
27742782
if (!swift_ast_sp->GetClangImporter()) {
27752783
logError("couldn't create a ClangImporter");
27762784
return {};

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ class SwiftASTContext : public TypeSystemSwift {
211211
std::set<lldb::LanguageType> &languages_for_types,
212212
std::set<lldb::LanguageType> &languages_for_expressions);
213213

214+
/// Set LangOpt overrides LLDB needs.
215+
void SetCompilerInvocationLLDBOverrides();
216+
214217
bool SupportsLanguage(lldb::LanguageType language) override;
215218

216219
SwiftASTContext *GetSwiftASTContext(const SymbolContext *sc) const override {

0 commit comments

Comments
 (0)