Commit 76016f9b authored by Raphael Isemann's avatar Raphael Isemann
Browse files

[lldb][NFC] Early exit in ClangASTContext::CreateInstance

parent 656a8123
Loading
Loading
Loading
Loading
+41 −41
Original line number Diff line number Diff line
@@ -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();
}