aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Interpreter/Interpreter.cpp
diff options
context:
space:
mode:
authorLuke Drummond <luke.drummond@codeplay.com>2021-10-07 15:44:38 +0100
committerLuke Drummond <luke.drummond@codeplay.com>2021-10-07 18:34:16 +0100
commit6283d468e28b35e2731dda1a9e0efcb3d9acf557 (patch)
tree4f26b4464f4080ef64aae2c6e8315930d8da1cdc /clang/lib/Interpreter/Interpreter.cpp
parent3d7d5437433c16fd4a9a3674d3752c246961d70e (diff)
downloadllvm-6283d468e28b35e2731dda1a9e0efcb3d9acf557.zip
llvm-6283d468e28b35e2731dda1a9e0efcb3d9acf557.tar.gz
llvm-6283d468e28b35e2731dda1a9e0efcb3d9acf557.tar.bz2
Workaround build error for mingw-g++
mingw-g++ does not correctly support the full `std::errc` namespace as worded in the standard[1]. As such, we cannot reliably use all names therein. This patch changes the use of `std::errc::state_not_recoverable`, to use portable error codes from the `llvm::errc` equivalent. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71444 Reviewed by v.g.vassilev Differential Revision: https://reviews.llvm.org/D111315
Diffstat (limited to 'clang/lib/Interpreter/Interpreter.cpp')
-rw-r--r--clang/lib/Interpreter/Interpreter.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp
index 3e8d388..28c6c4f 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -30,6 +30,7 @@
#include "clang/Lex/PreprocessorOptions.h"
#include "llvm/IR/Module.h"
+#include "llvm/Support/Errc.h"
#include "llvm/Support/Host.h"
using namespace clang;
@@ -47,14 +48,14 @@ GetCC1Arguments(DiagnosticsEngine *Diagnostics,
// failed. Extract that job from the Compilation.
const driver::JobList &Jobs = Compilation->getJobs();
if (!Jobs.size() || !isa<driver::Command>(*Jobs.begin()))
- return llvm::createStringError(std::errc::state_not_recoverable,
+ return llvm::createStringError(llvm::errc::not_supported,
"Driver initialization failed. "
"Unable to create a driver job");
// The one job we find should be to invoke clang again.
const driver::Command *Cmd = cast<driver::Command>(&(*Jobs.begin()));
if (llvm::StringRef(Cmd->getCreator().getName()) != "clang")
- return llvm::createStringError(std::errc::state_not_recoverable,
+ return llvm::createStringError(llvm::errc::not_supported,
"Driver initialization failed");
return &Cmd->getArguments();
@@ -89,13 +90,13 @@ CreateCI(const llvm::opt::ArgStringList &Argv) {
// Create the actual diagnostics engine.
Clang->createDiagnostics();
if (!Clang->hasDiagnostics())
- return llvm::createStringError(std::errc::state_not_recoverable,
+ return llvm::createStringError(llvm::errc::not_supported,
"Initialization failed. "
"Unable to create diagnostics engine");
DiagsBuffer->FlushDiagnostics(Clang->getDiagnostics());
if (!Success)
- return llvm::createStringError(std::errc::state_not_recoverable,
+ return llvm::createStringError(llvm::errc::not_supported,
"Initialization failed. "
"Unable to flush diagnostics");
@@ -106,7 +107,7 @@ CreateCI(const llvm::opt::ArgStringList &Argv) {
Clang->setTarget(TargetInfo::CreateTargetInfo(
Clang->getDiagnostics(), Clang->getInvocation().TargetOpts));
if (!Clang->hasTarget())
- return llvm::createStringError(std::errc::state_not_recoverable,
+ return llvm::createStringError(llvm::errc::not_supported,
"Initialization failed. "
"Target is missing");