[clang-tools-extra] 72a8367 - Replace LLVM_ATTRIBUTE_NORETURN with C++11 [[noreturn]]. NFC

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 29 09:59:53 PDT 2021


Author: Fangrui Song
Date: 2021-07-29T09:59:45-07:00
New Revision: 72a83674dd3a13b59442cd7cb07b53902f7d6a33

URL: https://github.com/llvm/llvm-project/commit/72a83674dd3a13b59442cd7cb07b53902f7d6a33
DIFF: https://github.com/llvm/llvm-project/commit/72a83674dd3a13b59442cd7cb07b53902f7d6a33.diff

LOG: 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.

Added: 
    

Modified: 
    clang-tools-extra/pp-trace/PPTrace.cpp
    clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
    flang/include/flang/Optimizer/Support/FatalError.h
    lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
    lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/pp-trace/PPTrace.cpp b/clang-tools-extra/pp-trace/PPTrace.cpp
index 3fa16498fbefc..0b078c49a55b7 100644
--- a/clang-tools-extra/pp-trace/PPTrace.cpp
+++ b/clang-tools-extra/pp-trace/PPTrace.cpp
@@ -69,7 +69,7 @@ static cl::opt<std::string> 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 014c1adcd8092..ad4bb8d78ced3 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 602045346587c..8450b16a5baf4 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 25dcf1e592c57..b49b541927afe 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 5b337f1974ea5..5f8057d2fef63 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);
 


        


More information about the cfe-commits mailing list