forked from OSchip/llvm-project
[lldb][NFC] Early exit in ClangASTContext::CreateInstance
This commit is contained in:
parent
656a8123de
commit
76016f9b3a
|
@ -562,14 +562,17 @@ uint32_t ClangASTContext::GetPluginVersion() { return 1; }
|
|||
lldb::TypeSystemSP ClangASTContext::CreateInstance(lldb::LanguageType language,
|
||||
lldb_private::Module *module,
|
||||
Target *target) {
|
||||
if (ClangASTContextSupportsLanguage(language)) {
|
||||
if (!ClangASTContextSupportsLanguage(language))
|
||||
return lldb::TypeSystemSP();
|
||||
ArchSpec arch;
|
||||
if (module)
|
||||
arch = module->GetArchitecture();
|
||||
else if (target)
|
||||
arch = target->GetArchitecture();
|
||||
|
||||
if (arch.IsValid()) {
|
||||
if (!arch.IsValid())
|
||||
return lldb::TypeSystemSP();
|
||||
|
||||
ArchSpec fixed_arch = arch;
|
||||
// LLVM wants this to be set to iOS or MacOSX; if we're working on
|
||||
// a bare-boards type image, change the triple for llvm's benefit.
|
||||
|
@ -586,8 +589,7 @@ lldb::TypeSystemSP ClangASTContext::CreateInstance(lldb::LanguageType language,
|
|||
}
|
||||
|
||||
if (module) {
|
||||
std::shared_ptr<ClangASTContext> ast_sp(
|
||||
new ClangASTContext(fixed_arch));
|
||||
std::shared_ptr<ClangASTContext> ast_sp(new ClangASTContext(fixed_arch));
|
||||
return ast_sp;
|
||||
} else if (target && target->IsValid()) {
|
||||
std::shared_ptr<ClangASTContextForExpressions> ast_sp(
|
||||
|
@ -602,8 +604,6 @@ lldb::TypeSystemSP ClangASTContext::CreateInstance(lldb::LanguageType language,
|
|||
ast_sp->SetExternalSource(proxy_ast_source);
|
||||
return ast_sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return lldb::TypeSystemSP();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue