[clang-repl] Better match the underlying architecture.

In cases where -fno-integrated-as is specified we should overwrite the
EmitAssembly action as well.

We also should rely on the target triple from the process at least until we
implement out-of-process execution.

This patch should improve clang-repl on AIX.

Discussion available at: https://reviews.llvm.org/D96033

Differential revision: https://reviews.llvm.org/D102688
This commit is contained in:
Vassil Vassilev 2021-05-18 17:53:54 +00:00
parent 0f544be244
commit 8dd5ef01ef
2 changed files with 5 additions and 2 deletions

View File

@ -54,7 +54,8 @@ public:
Err = llvm::createStringError(
std::errc::state_not_recoverable,
"Driver initialization failed. "
"Incremental mode for action is not supported");
"Incremental mode for action %d is not supported",
CI.getFrontendOpts().ProgramAction);
return Act;
case frontend::ASTDump:
LLVM_FALLTHROUGH;
@ -63,6 +64,8 @@ public:
case frontend::ParseSyntaxOnly:
Act = CreateFrontendAction(CI);
break;
case frontend::EmitAssembly:
LLVM_FALLTHROUGH;
case frontend::EmitObj:
LLVM_FALLTHROUGH;
case frontend::EmitLLVMOnly:

View File

@ -157,7 +157,7 @@ IncrementalCompilerBuilder::create(std::vector<const char *> &ClangArgv) {
ParseDiagnosticArgs(*DiagOpts, ParsedArgs, &Diags);
driver::Driver Driver(/*MainBinaryName=*/ClangArgv[0],
llvm::sys::getDefaultTargetTriple(), Diags);
llvm::sys::getProcessTriple(), Diags);
Driver.setCheckInputsExist(false); // the input comes from mem buffers
llvm::ArrayRef<const char *> RF = llvm::makeArrayRef(ClangArgv);
std::unique_ptr<driver::Compilation> Compilation(Driver.BuildCompilation(RF));