forked from OSchip/llvm-project
[llvm] Replace LLVM_ATTRIBUTE_NORETURN with C++11 [[noreturn]]
[[noreturn]] can be used since Oct 2016 when the minimum compiler requirement was bumped to GCC 4.8/MSVC 2015. Note: the definition of LLVM_ATTRIBUTE_NORETURN is kept for now.
This commit is contained in:
parent
49f745f59c
commit
6da3d8b19c
|
@ -817,7 +817,7 @@ namespace llvm {
|
|||
// Unrecoverable error has occurred. Display the best diagnostic we can
|
||||
// and bail via exit(1). For now, most MC backend errors are unrecoverable.
|
||||
// FIXME: We should really do something about that.
|
||||
LLVM_ATTRIBUTE_NORETURN void reportFatalError(SMLoc L, const Twine &Msg);
|
||||
[[noreturn]] void reportFatalError(SMLoc L, const Twine &Msg);
|
||||
|
||||
const MCAsmMacro *lookupMacro(StringRef Name) {
|
||||
StringMap<MCAsmMacro>::iterator I = MacroMap.find(Name);
|
||||
|
|
|
@ -99,8 +99,7 @@ public:
|
|||
|
||||
/// Explicitly trigger a crash recovery in the current process, and
|
||||
/// return failure from RunSafely(). This function does not return.
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
void HandleExit(int RetCode);
|
||||
[[noreturn]] void HandleExit(int RetCode);
|
||||
|
||||
/// Throw again a signal or an exception, after it was catched once by a
|
||||
/// CrashRecoveryContext.
|
||||
|
|
|
@ -257,8 +257,7 @@ private:
|
|||
// of debug prints can cause the function to be too large for inlining. So
|
||||
// it's important that we define this function out of line so that it can't be
|
||||
// inlined.
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
void fatalUncheckedError() const;
|
||||
[[noreturn]] void fatalUncheckedError() const;
|
||||
#endif
|
||||
|
||||
void assertIsChecked() {
|
||||
|
@ -688,9 +687,7 @@ private:
|
|||
}
|
||||
|
||||
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
LLVM_ATTRIBUTE_NOINLINE
|
||||
void fatalUncheckedExpected() const {
|
||||
[[noreturn]] LLVM_ATTRIBUTE_NOINLINE void fatalUncheckedExpected() const {
|
||||
dbgs() << "Expected<T> must be checked before access or destruction.\n";
|
||||
if (HasError) {
|
||||
dbgs() << "Unchecked Expected<T> contained error:\n";
|
||||
|
@ -722,8 +719,7 @@ private:
|
|||
|
||||
/// Report a serious error, calling any installed error handler. See
|
||||
/// ErrorHandling.h.
|
||||
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err,
|
||||
bool gen_crash_diag = true);
|
||||
[[noreturn]] void report_fatal_error(Error Err, bool gen_crash_diag = true);
|
||||
|
||||
/// Report a fatal error if Err is a failure value.
|
||||
///
|
||||
|
|
|
@ -68,14 +68,14 @@ class StringRef;
|
|||
/// standard error, followed by a newline.
|
||||
/// After the error handler is called this function will call abort(), it
|
||||
/// does not return.
|
||||
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason,
|
||||
bool gen_crash_diag = true);
|
||||
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const std::string &reason,
|
||||
bool gen_crash_diag = true);
|
||||
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(StringRef reason,
|
||||
bool gen_crash_diag = true);
|
||||
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const Twine &reason,
|
||||
bool gen_crash_diag = true);
|
||||
[[noreturn]] void report_fatal_error(const char *reason,
|
||||
bool gen_crash_diag = true);
|
||||
[[noreturn]] void report_fatal_error(const std::string &reason,
|
||||
bool gen_crash_diag = true);
|
||||
[[noreturn]] void report_fatal_error(StringRef reason,
|
||||
bool gen_crash_diag = true);
|
||||
[[noreturn]] void report_fatal_error(const Twine &reason,
|
||||
bool gen_crash_diag = true);
|
||||
|
||||
/// Installs a new bad alloc error handler that should be used whenever a
|
||||
/// bad alloc error, e.g. failing malloc/calloc, is encountered by LLVM.
|
||||
|
@ -113,13 +113,13 @@ void install_out_of_memory_new_handler();
|
|||
/// If no error handler is installed (default), throws a bad_alloc exception
|
||||
/// if LLVM is compiled with exception support. Otherwise prints the error
|
||||
/// to standard error and calls abort().
|
||||
LLVM_ATTRIBUTE_NORETURN void report_bad_alloc_error(const char *Reason,
|
||||
bool GenCrashDiag = true);
|
||||
[[noreturn]] void report_bad_alloc_error(const char *Reason,
|
||||
bool GenCrashDiag = true);
|
||||
|
||||
/// This function calls abort(), and prints the optional message to stderr.
|
||||
/// Use the llvm_unreachable macro (that adds location info), instead of
|
||||
/// calling this function directly.
|
||||
LLVM_ATTRIBUTE_NORETURN void
|
||||
[[noreturn]] void
|
||||
llvm_unreachable_internal(const char *msg = nullptr, const char *file = nullptr,
|
||||
unsigned line = 0);
|
||||
}
|
||||
|
|
|
@ -214,12 +214,10 @@ public:
|
|||
/// In that case, the control flow will resume after RunSafely(), like for a
|
||||
/// crash, rather than exiting the current process.
|
||||
/// Use \arg NoCleanup for calling _exit() instead of exit().
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
static void Exit(int RetCode, bool NoCleanup = false);
|
||||
[[noreturn]] static void Exit(int RetCode, bool NoCleanup = false);
|
||||
|
||||
private:
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
static void ExitNoCleanup(int RetCode);
|
||||
[[noreturn]] static void ExitNoCleanup(int RetCode);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ llvm::VersionTuple GetWindowsOSVersion();
|
|||
bool MakeErrMsg(std::string *ErrMsg, const std::string &prefix);
|
||||
|
||||
// Include GetLastError() in a fatal error message.
|
||||
LLVM_ATTRIBUTE_NORETURN inline void ReportLastErrorFatal(const char *Msg) {
|
||||
[[noreturn]] inline void ReportLastErrorFatal(const char *Msg) {
|
||||
std::string ErrMsg;
|
||||
MakeErrMsg(&ErrMsg, Msg);
|
||||
llvm::report_fatal_error(ErrMsg);
|
||||
|
|
|
@ -22,13 +22,10 @@ namespace llvm {
|
|||
void PrintNote(const Twine &Msg);
|
||||
void PrintNote(ArrayRef<SMLoc> NoteLoc, const Twine &Msg);
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN void PrintFatalNote(const Twine &Msg);
|
||||
LLVM_ATTRIBUTE_NORETURN void PrintFatalNote(ArrayRef<SMLoc> ErrorLoc,
|
||||
const Twine &Msg);
|
||||
LLVM_ATTRIBUTE_NORETURN void PrintFatalNote(const Record *Rec,
|
||||
const Twine &Msg);
|
||||
LLVM_ATTRIBUTE_NORETURN void PrintFatalNote(const RecordVal *RecVal,
|
||||
const Twine &Msg);
|
||||
[[noreturn]] void PrintFatalNote(const Twine &Msg);
|
||||
[[noreturn]] void PrintFatalNote(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg);
|
||||
[[noreturn]] void PrintFatalNote(const Record *Rec, const Twine &Msg);
|
||||
[[noreturn]] void PrintFatalNote(const RecordVal *RecVal, const Twine &Msg);
|
||||
|
||||
void PrintWarning(const Twine &Msg);
|
||||
void PrintWarning(ArrayRef<SMLoc> WarningLoc, const Twine &Msg);
|
||||
|
@ -40,13 +37,10 @@ void PrintError(const char *Loc, const Twine &Msg);
|
|||
void PrintError(const Record *Rec, const Twine &Msg);
|
||||
void PrintError(const RecordVal *RecVal, const Twine &Msg);
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN void PrintFatalError(const Twine &Msg);
|
||||
LLVM_ATTRIBUTE_NORETURN void PrintFatalError(ArrayRef<SMLoc> ErrorLoc,
|
||||
const Twine &Msg);
|
||||
LLVM_ATTRIBUTE_NORETURN void PrintFatalError(const Record *Rec,
|
||||
const Twine &Msg);
|
||||
LLVM_ATTRIBUTE_NORETURN void PrintFatalError(const RecordVal *RecVal,
|
||||
const Twine &Msg);
|
||||
[[noreturn]] void PrintFatalError(const Twine &Msg);
|
||||
[[noreturn]] void PrintFatalError(ArrayRef<SMLoc> ErrorLoc, const Twine &Msg);
|
||||
[[noreturn]] void PrintFatalError(const Record *Rec, const Twine &Msg);
|
||||
[[noreturn]] void PrintFatalError(const RecordVal *RecVal, const Twine &Msg);
|
||||
|
||||
void CheckAssert(SMLoc Loc, Init *Condition, Init *Message);
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ static cl::opt<bool> ThinLTOAssumeMerged(
|
|||
cl::desc("Assume the input has already undergone ThinLTO function "
|
||||
"importing and the other pre-optimization pipeline changes."));
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN static void reportOpenError(StringRef Path, Twine Msg) {
|
||||
[[noreturn]] static void reportOpenError(StringRef Path, Twine Msg) {
|
||||
errs() << "failed to open " << Path << ": " << Msg << '\n';
|
||||
errs().flush();
|
||||
exit(1);
|
||||
|
|
|
@ -428,8 +428,7 @@ bool CrashRecoveryContext::RunSafely(function_ref<void()> Fn) {
|
|||
|
||||
#endif // !_MSC_VER
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
void CrashRecoveryContext::HandleExit(int RetCode) {
|
||||
[[noreturn]] void CrashRecoveryContext::HandleExit(int RetCode) {
|
||||
#if defined(_WIN32)
|
||||
// SEH and VEH
|
||||
::RaiseException(0xE0000000 | RetCode, 0, 0, NULL);
|
||||
|
|
|
@ -92,8 +92,7 @@ static bool coreFilesPrevented = !LLVM_ENABLE_CRASH_DUMPS;
|
|||
|
||||
bool Process::AreCoreFilesPrevented() { return coreFilesPrevented; }
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
void Process::Exit(int RetCode, bool NoCleanup) {
|
||||
[[noreturn]] void Process::Exit(int RetCode, bool NoCleanup) {
|
||||
if (CrashRecoveryContext *CRC = CrashRecoveryContext::GetCurrent())
|
||||
CRC->HandleExit(RetCode);
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@ static_assert(sizeof(SmallVector<char, 0>) ==
|
|||
|
||||
/// Report that MinSize doesn't fit into this vector's size type. Throws
|
||||
/// std::length_error or calls report_fatal_error.
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
static void report_size_overflow(size_t MinSize, size_t MaxSize);
|
||||
[[noreturn]] static void report_size_overflow(size_t MinSize, size_t MaxSize);
|
||||
static void report_size_overflow(size_t MinSize, size_t MaxSize) {
|
||||
std::string Reason = "SmallVector unable to grow. Requested capacity (" +
|
||||
std::to_string(MinSize) +
|
||||
|
@ -63,7 +62,7 @@ static void report_size_overflow(size_t MinSize, size_t MaxSize) {
|
|||
|
||||
/// Report that this vector is already at maximum capacity. Throws
|
||||
/// std::length_error or calls report_fatal_error.
|
||||
LLVM_ATTRIBUTE_NORETURN static void report_at_maximum_capacity(size_t MaxSize);
|
||||
[[noreturn]] static void report_at_maximum_capacity(size_t MaxSize);
|
||||
static void report_at_maximum_capacity(size_t MaxSize) {
|
||||
std::string Reason =
|
||||
"SmallVector capacity unable to grow. Already at maximum size " +
|
||||
|
|
|
@ -461,5 +461,4 @@ unsigned llvm::sys::Process::GetRandomNumber() {
|
|||
#endif
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
void Process::ExitNoCleanup(int RetCode) { _Exit(RetCode); }
|
||||
[[noreturn]] void Process::ExitNoCleanup(int RetCode) { _Exit(RetCode); }
|
||||
|
|
|
@ -67,8 +67,7 @@ static inline bool MakeErrMsg(
|
|||
}
|
||||
|
||||
// Include StrError(errnum) in a fatal error message.
|
||||
LLVM_ATTRIBUTE_NORETURN static inline void ReportErrnumFatal(const char *Msg,
|
||||
int errnum) {
|
||||
[[noreturn]] static inline void ReportErrnumFatal(const char *Msg, int errnum) {
|
||||
std::string ErrMsg;
|
||||
MakeErrMsg(&ErrMsg, Msg, errnum);
|
||||
llvm::report_fatal_error(ErrMsg);
|
||||
|
|
|
@ -504,8 +504,7 @@ bool llvm::RunningWindows8OrGreater() {
|
|||
return GetWindowsOSVersion() >= llvm::VersionTuple(6, 2, 0, 0);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
void Process::ExitNoCleanup(int RetCode) {
|
||||
[[noreturn]] void Process::ExitNoCleanup(int RetCode) {
|
||||
TerminateProcess(GetCurrentProcess(), RetCode);
|
||||
llvm_unreachable("TerminateProcess doesn't return");
|
||||
}
|
||||
|
|
|
@ -448,8 +448,7 @@ void HexagonMCCodeEmitter::EncodeSingleInstruction(const MCInst &MI,
|
|||
++MCNumEmitted;
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
static void raise_relocation_error(unsigned Width, unsigned Kind) {
|
||||
[[noreturn]] static void raise_relocation_error(unsigned Width, unsigned Kind) {
|
||||
std::string Text;
|
||||
raw_string_ostream Stream(Text);
|
||||
Stream << "Unrecognized relocation combination: width=" << Width
|
||||
|
|
|
@ -571,8 +571,8 @@ void coro::Shape::emitDealloc(IRBuilder<> &Builder, Value *Ptr,
|
|||
llvm_unreachable("Unknown coro::ABI enum");
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
static void fail(const Instruction *I, const char *Reason, Value *V) {
|
||||
[[noreturn]] static void fail(const Instruction *I, const char *Reason,
|
||||
Value *V) {
|
||||
#ifndef NDEBUG
|
||||
I->dump();
|
||||
if (V) {
|
||||
|
|
|
@ -201,8 +201,7 @@ static cl::opt<RunPassOption, true, cl::parser<std::string>> RunPass(
|
|||
|
||||
static int compileModule(char **, LLVMContext &);
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN static void reportError(Twine Msg,
|
||||
StringRef Filename = "") {
|
||||
[[noreturn]] static void reportError(Twine Msg, StringRef Filename = "") {
|
||||
SmallString<256> Prefix;
|
||||
if (!Filename.empty()) {
|
||||
if (Filename == "-")
|
||||
|
@ -213,7 +212,7 @@ LLVM_ATTRIBUTE_NORETURN static void reportError(Twine Msg,
|
|||
exit(1);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN static void reportError(Error Err, StringRef Filename) {
|
||||
[[noreturn]] static void reportError(Error Err, StringRef Filename) {
|
||||
assert(Err);
|
||||
handleAllErrors(createFileError(Filename, std::move(Err)),
|
||||
[&](const ErrorInfoBase &EI) { reportError(EI.message()); });
|
||||
|
|
|
@ -410,8 +410,7 @@ CodeGenOpt::Level getOptLevel() {
|
|||
llvm_unreachable("Unrecognized opt level.");
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
static void reportError(SMDiagnostic Err, const char *ProgName) {
|
||||
[[noreturn]] static void reportError(SMDiagnostic Err, const char *ProgName) {
|
||||
Err.print(ProgName, errs());
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -136,14 +136,14 @@ static unsigned MRILineNumber;
|
|||
static bool ParsingMRIScript;
|
||||
|
||||
// Show the error plus the usage message, and exit.
|
||||
LLVM_ATTRIBUTE_NORETURN static void badUsage(Twine Error) {
|
||||
[[noreturn]] static void badUsage(Twine Error) {
|
||||
WithColor::error(errs(), ToolName) << Error << "\n";
|
||||
printHelpMessage();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Show the error message and exit.
|
||||
LLVM_ATTRIBUTE_NORETURN static void fail(Twine Error) {
|
||||
[[noreturn]] static void fail(Twine Error) {
|
||||
if (ParsingMRIScript) {
|
||||
WithColor::error(errs(), ToolName)
|
||||
<< "script line " << MRILineNumber << ": " << Error << "\n";
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
};
|
||||
}
|
||||
|
||||
static LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg) {
|
||||
[[noreturn]] static void reportError(Twine Msg) {
|
||||
errs() << Msg;
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ static void error(std::error_code EC) {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN static void error(Error Err) {
|
||||
[[noreturn]] static void error(Error Err) {
|
||||
logAllUnhandledErrors(std::move(Err), WithColor::error(outs()),
|
||||
"reading file: ");
|
||||
outs().flush();
|
||||
|
|
|
@ -57,7 +57,7 @@ ErrorCollector::~ErrorCollector() {
|
|||
}
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN void ErrorCollector::fatalUnhandledError() {
|
||||
[[noreturn]] void ErrorCollector::fatalUnhandledError() {
|
||||
errs() << "Program aborted due to unhandled Error(s):\n";
|
||||
log(errs());
|
||||
errs() << "\n";
|
||||
|
|
|
@ -61,7 +61,7 @@ private:
|
|||
bool allErrorsHandled() const;
|
||||
|
||||
/// Dump output and crash.
|
||||
LLVM_ATTRIBUTE_NORETURN void fatalUnhandledError();
|
||||
[[noreturn]] void fatalUnhandledError();
|
||||
|
||||
bool ErrorsAreFatal;
|
||||
std::vector<Error> Errors;
|
||||
|
|
|
@ -36,13 +36,13 @@ using namespace llvm::object;
|
|||
static const StringRef ToolName = "llvm-lipo";
|
||||
static LLVMContext LLVMCtx;
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN static void reportError(Twine Message) {
|
||||
[[noreturn]] static void reportError(Twine Message) {
|
||||
WithColor::error(errs(), ToolName) << Message << "\n";
|
||||
errs().flush();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN static void reportError(Error E) {
|
||||
[[noreturn]] static void reportError(Error E) {
|
||||
assert(E);
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
|
@ -51,7 +51,7 @@ LLVM_ATTRIBUTE_NORETURN static void reportError(Error E) {
|
|||
reportError(Buf);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN static void reportError(StringRef File, Error E) {
|
||||
[[noreturn]] static void reportError(StringRef File, Error E) {
|
||||
assert(E);
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
|
@ -350,9 +350,9 @@ readInputBinaries(ArrayRef<InputFile> InputFiles) {
|
|||
return InputBinaries;
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
static void verifyArch(ArrayRef<OwningBinary<Binary>> InputBinaries,
|
||||
ArrayRef<std::string> VerifyArchList) {
|
||||
[[noreturn]] static void
|
||||
verifyArch(ArrayRef<OwningBinary<Binary>> InputBinaries,
|
||||
ArrayRef<std::string> VerifyArchList) {
|
||||
assert(!VerifyArchList.empty() &&
|
||||
"The list of architectures should be non-empty");
|
||||
assert(InputBinaries.size() == 1 && "Incorrect number of input binaries");
|
||||
|
@ -433,15 +433,15 @@ static void printBinaryArchs(const Binary *Binary, raw_ostream &OS) {
|
|||
OS << SliceOrErr->getArchString() << " \n";
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
static void printArchs(ArrayRef<OwningBinary<Binary>> InputBinaries) {
|
||||
[[noreturn]] static void
|
||||
printArchs(ArrayRef<OwningBinary<Binary>> InputBinaries) {
|
||||
assert(InputBinaries.size() == 1 && "Incorrect number of input binaries");
|
||||
printBinaryArchs(InputBinaries.front().getBinary(), outs());
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
static void printInfo(ArrayRef<OwningBinary<Binary>> InputBinaries) {
|
||||
[[noreturn]] static void
|
||||
printInfo(ArrayRef<OwningBinary<Binary>> InputBinaries) {
|
||||
// Group universal and thin files together for compatibility with cctools lipo
|
||||
for (auto &IB : InputBinaries) {
|
||||
const Binary *Binary = IB.getBinary();
|
||||
|
@ -463,9 +463,9 @@ static void printInfo(ArrayRef<OwningBinary<Binary>> InputBinaries) {
|
|||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
static void thinSlice(ArrayRef<OwningBinary<Binary>> InputBinaries,
|
||||
StringRef ArchType, StringRef OutputFileName) {
|
||||
[[noreturn]] static void thinSlice(ArrayRef<OwningBinary<Binary>> InputBinaries,
|
||||
StringRef ArchType,
|
||||
StringRef OutputFileName) {
|
||||
assert(!ArchType.empty() && "The architecture type should be non-empty");
|
||||
assert(InputBinaries.size() == 1 && "Incorrect number of input binaries");
|
||||
assert(!OutputFileName.empty() && "Thin expects a single output file");
|
||||
|
@ -599,10 +599,10 @@ buildSlices(ArrayRef<OwningBinary<Binary>> InputBinaries,
|
|||
return Slices;
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
static void createUniversalBinary(ArrayRef<OwningBinary<Binary>> InputBinaries,
|
||||
const StringMap<const uint32_t> &Alignments,
|
||||
StringRef OutputFileName) {
|
||||
[[noreturn]] static void
|
||||
createUniversalBinary(ArrayRef<OwningBinary<Binary>> InputBinaries,
|
||||
const StringMap<const uint32_t> &Alignments,
|
||||
StringRef OutputFileName) {
|
||||
assert(InputBinaries.size() >= 1 && "Incorrect number of input binaries");
|
||||
assert(!OutputFileName.empty() && "Create expects a single output file");
|
||||
|
||||
|
@ -619,10 +619,10 @@ static void createUniversalBinary(ArrayRef<OwningBinary<Binary>> InputBinaries,
|
|||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
static void extractSlice(ArrayRef<OwningBinary<Binary>> InputBinaries,
|
||||
const StringMap<const uint32_t> &Alignments,
|
||||
StringRef ArchType, StringRef OutputFileName) {
|
||||
[[noreturn]] static void
|
||||
extractSlice(ArrayRef<OwningBinary<Binary>> InputBinaries,
|
||||
const StringMap<const uint32_t> &Alignments, StringRef ArchType,
|
||||
StringRef OutputFileName) {
|
||||
assert(!ArchType.empty() &&
|
||||
"The architecture type should be non-empty");
|
||||
assert(InputBinaries.size() == 1 && "Incorrect number of input binaries");
|
||||
|
@ -678,11 +678,10 @@ buildReplacementSlices(ArrayRef<OwningBinary<Binary>> ReplacementBinaries,
|
|||
return Slices;
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN
|
||||
static void replaceSlices(ArrayRef<OwningBinary<Binary>> InputBinaries,
|
||||
const StringMap<const uint32_t> &Alignments,
|
||||
StringRef OutputFileName,
|
||||
ArrayRef<InputFile> ReplacementFiles) {
|
||||
[[noreturn]] static void
|
||||
replaceSlices(ArrayRef<OwningBinary<Binary>> InputBinaries,
|
||||
const StringMap<const uint32_t> &Alignments,
|
||||
StringRef OutputFileName, ArrayRef<InputFile> ReplacementFiles) {
|
||||
assert(InputBinaries.size() == 1 && "Incorrect number of input binaries");
|
||||
assert(!OutputFileName.empty() && "Replace expects a single output file");
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
};
|
||||
} // namespace
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN static void reportError(Twine Msg) {
|
||||
[[noreturn]] static void reportError(Twine Msg) {
|
||||
WithColor::error(errs(), "llvm-mt") << Msg << '\n';
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -297,16 +297,15 @@ void objdump::reportWarning(const Twine &Message, StringRef File) {
|
|||
<< "'" << File << "': " << Message << "\n";
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN void objdump::reportError(StringRef File,
|
||||
const Twine &Message) {
|
||||
[[noreturn]] void objdump::reportError(StringRef File, const Twine &Message) {
|
||||
outs().flush();
|
||||
WithColor::error(errs(), ToolName) << "'" << File << "': " << Message << "\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN void objdump::reportError(Error E, StringRef FileName,
|
||||
StringRef ArchiveName,
|
||||
StringRef ArchitectureName) {
|
||||
[[noreturn]] void objdump::reportError(Error E, StringRef FileName,
|
||||
StringRef ArchiveName,
|
||||
StringRef ArchitectureName) {
|
||||
assert(E);
|
||||
outs().flush();
|
||||
WithColor::error(errs(), ToolName);
|
||||
|
@ -325,7 +324,7 @@ static void reportCmdLineWarning(const Twine &Message) {
|
|||
WithColor::warning(errs(), ToolName) << Message << "\n";
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN static void reportCmdLineError(const Twine &Message) {
|
||||
[[noreturn]] static void reportCmdLineError(const Twine &Message) {
|
||||
WithColor::error(errs(), ToolName) << Message << "\n";
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -139,10 +139,10 @@ void printSymbolTable(const object::ObjectFile *O, StringRef ArchiveName,
|
|||
void printSymbol(const object::ObjectFile *O, const object::SymbolRef &Symbol,
|
||||
StringRef FileName, StringRef ArchiveName,
|
||||
StringRef ArchitectureName, bool DumpDynamic);
|
||||
LLVM_ATTRIBUTE_NORETURN void reportError(StringRef File, const Twine &Message);
|
||||
LLVM_ATTRIBUTE_NORETURN void reportError(Error E, StringRef FileName,
|
||||
StringRef ArchiveName = "",
|
||||
StringRef ArchitectureName = "");
|
||||
[[noreturn]] void reportError(StringRef File, const Twine &Message);
|
||||
[[noreturn]] void reportError(Error E, StringRef FileName,
|
||||
StringRef ArchiveName = "",
|
||||
StringRef ArchitectureName = "");
|
||||
void reportWarning(const Twine &Message, StringRef File);
|
||||
|
||||
template <typename T, typename... Ts>
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
using namespace llvm;
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN inline void
|
||||
exitWithError(const Twine &Message, StringRef Whence = StringRef(),
|
||||
StringRef Hint = StringRef()) {
|
||||
[[noreturn]] inline void exitWithError(const Twine &Message,
|
||||
StringRef Whence = StringRef(),
|
||||
StringRef Hint = StringRef()) {
|
||||
WithColor::error(errs(), "llvm-profgen");
|
||||
if (!Whence.empty())
|
||||
errs() << Whence.str() << ": ";
|
||||
|
@ -30,12 +30,12 @@ exitWithError(const Twine &Message, StringRef Whence = StringRef(),
|
|||
::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN inline void
|
||||
exitWithError(std::error_code EC, StringRef Whence = StringRef()) {
|
||||
[[noreturn]] inline void exitWithError(std::error_code EC,
|
||||
StringRef Whence = StringRef()) {
|
||||
exitWithError(EC.message(), Whence);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN inline void exitWithError(Error E, StringRef Whence) {
|
||||
[[noreturn]] inline void exitWithError(Error E, StringRef Whence) {
|
||||
exitWithError(errorToErrorCode(std::move(E)), Whence);
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ static ExitOnError ExitOnErr;
|
|||
static FileRemover TempPreprocFile;
|
||||
static FileRemover TempResFile;
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN static void fatalError(const Twine &Message) {
|
||||
[[noreturn]] static void fatalError(const Twine &Message) {
|
||||
errs() << Message << "\n";
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ static StringRef ToolName;
|
|||
|
||||
namespace llvm {
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN static void error(Twine Msg) {
|
||||
[[noreturn]] static void error(Twine Msg) {
|
||||
// Flush the standard output to print the error at a
|
||||
// proper place.
|
||||
fouts().flush();
|
||||
|
@ -165,7 +165,7 @@ LLVM_ATTRIBUTE_NORETURN static void error(Twine Msg) {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN void reportError(Error Err, StringRef Input) {
|
||||
[[noreturn]] void reportError(Error Err, StringRef Input) {
|
||||
assert(Err);
|
||||
if (Input == "-")
|
||||
Input = "<stdin>";
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace llvm {
|
|||
}
|
||||
|
||||
// Various helper functions.
|
||||
LLVM_ATTRIBUTE_NORETURN void reportError(Error Err, StringRef Input);
|
||||
[[noreturn]] void reportError(Error Err, StringRef Input);
|
||||
void reportWarning(Error Err, StringRef Input);
|
||||
|
||||
template <class T> T unwrapOrError(StringRef Input, Expected<T> EO) {
|
||||
|
|
|
@ -73,7 +73,7 @@ static bool PrintFileName;
|
|||
enum radix { none, octal, hexadecimal, decimal };
|
||||
static radix Radix;
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN static void reportCmdLineError(const Twine &Message) {
|
||||
[[noreturn]] static void reportCmdLineError(const Twine &Message) {
|
||||
WithColor::error(errs(), ToolName) << Message << "\n";
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -42,8 +42,7 @@ static cl::opt<bool> noLeadingLines("no-leading-lines",
|
|||
static StringRef toolName;
|
||||
static int errorCount;
|
||||
|
||||
LLVM_ATTRIBUTE_NORETURN static void fatal(StringRef filename,
|
||||
const Twine &message) {
|
||||
[[noreturn]] static void fatal(StringRef filename, const Twine &message) {
|
||||
if (filename.empty())
|
||||
WithColor::error(errs(), toolName) << message << '\n';
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue