From 72a83674dd3a13b59442cd7cb07b53902f7d6a33 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 29 Jul 2021 09:59:44 -0700 Subject: [PATCH] Replace LLVM_ATTRIBUTE_NORETURN with C++11 [[noreturn]]. NFC [[noreturn]] can be used since Oct 2016 when the minimum compiler requirement was bumped to GCC 4.8/MSVC 2015. --- clang-tools-extra/pp-trace/PPTrace.cpp | 2 +- clang/utils/TableGen/ClangDiagnosticsEmitter.cpp | 2 +- flang/include/flang/Optimizer/Support/FatalError.h | 4 ++-- lldb/source/Host/posix/ProcessLauncherPosixFork.cpp | 8 ++++---- lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/clang-tools-extra/pp-trace/PPTrace.cpp b/clang-tools-extra/pp-trace/PPTrace.cpp index 3fa16498fbef..0b078c49a55b 100644 --- a/clang-tools-extra/pp-trace/PPTrace.cpp +++ b/clang-tools-extra/pp-trace/PPTrace.cpp @@ -69,7 +69,7 @@ static cl::opt OutputFileName( cl::desc("Output trace to the given file name or '-' for stdout."), cl::cat(Cat)); -LLVM_ATTRIBUTE_NORETURN static void error(Twine Message) { +[[noreturn]] static void error(Twine Message) { WithColor::error() << Message << '\n'; exit(1); } diff --git a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp index 014c1adcd809..ad4bb8d78ced 100644 --- a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp +++ b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -614,7 +614,7 @@ struct DiagnosticTextBuilder { return It->second.Root; } - LLVM_ATTRIBUTE_NORETURN void PrintFatalError(llvm::Twine const &Msg) const { + [[noreturn]] void PrintFatalError(llvm::Twine const &Msg) const { assert(EvaluatingRecord && "not evaluating a record?"); llvm::PrintFatalError(EvaluatingRecord->getLoc(), Msg); } diff --git a/flang/include/flang/Optimizer/Support/FatalError.h b/flang/include/flang/Optimizer/Support/FatalError.h index 602045346587..8450b16a5baf 100644 --- a/flang/include/flang/Optimizer/Support/FatalError.h +++ b/flang/include/flang/Optimizer/Support/FatalError.h @@ -20,8 +20,8 @@ namespace fir { /// Fatal error reporting helper. Report a fatal error with a source location /// and immediately abort flang. -LLVM_ATTRIBUTE_NORETURN inline void emitFatalError(mlir::Location loc, - const llvm::Twine &message) { +[[noreturn]] inline void emitFatalError(mlir::Location loc, + const llvm::Twine &message) { mlir::emitError(loc, message); llvm::report_fatal_error("aborting"); } diff --git a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp index 25dcf1e592c5..b49b541927af 100644 --- a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp +++ b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp @@ -46,8 +46,8 @@ static void FixupEnvironment(Environment &env) { #endif } -static void LLVM_ATTRIBUTE_NORETURN ExitWithError(int error_fd, - const char *operation) { +[[noreturn]] static void ExitWithError(int error_fd, + const char *operation) { int err = errno; llvm::raw_fd_ostream os(error_fd, true); os << operation << " failed: " << llvm::sys::StrError(err); @@ -88,8 +88,8 @@ static void DupDescriptor(int error_fd, const FileSpec &file_spec, int fd, return; } -static void LLVM_ATTRIBUTE_NORETURN ChildFunc(int error_fd, - const ProcessLaunchInfo &info) { +[[noreturn]] static void ChildFunc(int error_fd, + const ProcessLaunchInfo &info) { if (info.GetFlags().Test(eLaunchFlagLaunchInSeparateProcessGroup)) { if (setpgid(0, 0) != 0) ExitWithError(error_fd, "setpgid"); diff --git a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp index 5b337f1974ea..5f8057d2fef6 100644 --- a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp +++ b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp @@ -29,7 +29,7 @@ using namespace lldb_private::process_linux; #if defined(__arm64__) || defined(__aarch64__) namespace { -void LLVM_ATTRIBUTE_NORETURN Child() { +[[noreturn]] void Child() { if (ptrace(PTRACE_TRACEME, 0, nullptr, nullptr) == -1) _exit(1);