[lld] 323b9bf - [lld] Replace LLVM_ATTRIBUTE_NORETURN with [[noreturn]]

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 27 18:51:22 PDT 2021


Author: Fangrui Song
Date: 2021-07-27T18:51:17-07:00
New Revision: 323b9bf862552c126865319d84afbad16a9f4941

URL: https://github.com/llvm/llvm-project/commit/323b9bf862552c126865319d84afbad16a9f4941
DIFF: https://github.com/llvm/llvm-project/commit/323b9bf862552c126865319d84afbad16a9f4941.diff

LOG: [lld] Replace LLVM_ATTRIBUTE_NORETURN with [[noreturn]]

[[noreturn]] can be used since 2016 when the minimum compiler requirement was bumped to GCC 4.8/MSVC 2015.

Added: 
    

Modified: 
    lld/include/lld/Common/ErrorHandler.h
    lld/tools/lld/lld.cpp

Removed: 
    


################################################################################
diff  --git a/lld/include/lld/Common/ErrorHandler.h b/lld/include/lld/Common/ErrorHandler.h
index 44604524027d9..95d92f3594ba6 100644
--- a/lld/include/lld/Common/ErrorHandler.h
+++ b/lld/include/lld/Common/ErrorHandler.h
@@ -107,7 +107,7 @@ class ErrorHandler {
 
   void error(const Twine &msg);
   void error(const Twine &msg, ErrorTag tag, ArrayRef<StringRef> args);
-  LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &msg);
+  [[noreturn]] void fatal(const Twine &msg);
   void log(const Twine &msg);
   void message(const Twine &msg);
   void warn(const Twine &msg);
@@ -133,15 +133,13 @@ inline void error(const Twine &msg) { errorHandler().error(msg); }
 inline void error(const Twine &msg, ErrorTag tag, ArrayRef<StringRef> args) {
   errorHandler().error(msg, tag, args);
 }
-inline LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &msg) {
-  errorHandler().fatal(msg);
-}
+[[noreturn]] inline void fatal(const Twine &msg) { errorHandler().fatal(msg); }
 inline void log(const Twine &msg) { errorHandler().log(msg); }
 inline void message(const Twine &msg) { errorHandler().message(msg); }
 inline void warn(const Twine &msg) { errorHandler().warn(msg); }
 inline uint64_t errorCount() { return errorHandler().errorCount; }
 
-LLVM_ATTRIBUTE_NORETURN void exitLld(int val);
+[[noreturn]] void exitLld(int val);
 
 void diagnosticHandler(const llvm::DiagnosticInfo &di);
 void checkError(Error e);

diff  --git a/lld/tools/lld/lld.cpp b/lld/tools/lld/lld.cpp
index 143f4c629ea0b..5d6142f5fd356 100644
--- a/lld/tools/lld/lld.cpp
+++ b/lld/tools/lld/lld.cpp
@@ -54,7 +54,7 @@ enum Flavor {
   Wasm,      // -flavor wasm
 };
 
-LLVM_ATTRIBUTE_NORETURN static void die(const Twine &s) {
+[[noreturn]] static void die(const Twine &s) {
   llvm::errs() << s << "\n";
   exit(1);
 }


        


More information about the llvm-commits mailing list