[clang] 6283d46 - Workaround build error for mingw-g++
Luke Drummond via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 7 10:36:07 PDT 2021
Author: Luke Drummond
Date: 2021-10-07T18:34:16+01:00
New Revision: 6283d468e28b35e2731dda1a9e0efcb3d9acf557
URL: https://github.com/llvm/llvm-project/commit/6283d468e28b35e2731dda1a9e0efcb3d9acf557
DIFF: https://github.com/llvm/llvm-project/commit/6283d468e28b35e2731dda1a9e0efcb3d9acf557.diff
LOG: 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
Added:
Modified:
clang/lib/Interpreter/Interpreter.cpp
Removed:
################################################################################
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp
index 3e8d3884049ba..28c6c4f4e80f8 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");
More information about the cfe-commits
mailing list