From 990504e625a3bf3f3276576f42e07dfdf9f74c4c Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 19 Oct 2016 23:52:38 +0000 Subject: [PATCH] Remove LLVM_NOEXCEPT and replace it with noexcept Now that we have dropped MSVC 2013, all supported compilers support noexcept and we can drop this portability macro. llvm-svn: 284672 --- llvm/include/llvm/MC/MCContext.h | 9 ++++----- llvm/include/llvm/Support/Compiler.h | 6 ------ llvm/include/llvm/Support/YAMLParser.h | 6 +++--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 2 +- llvm/lib/DebugInfo/CodeView/CodeViewError.cpp | 2 +- llvm/lib/DebugInfo/MSF/MSFError.cpp | 2 +- llvm/lib/DebugInfo/PDB/DIA/DIAError.cpp | 2 +- llvm/lib/DebugInfo/PDB/GenericError.cpp | 2 +- llvm/lib/DebugInfo/PDB/Raw/RawError.cpp | 2 +- llvm/lib/ExecutionEngine/Orc/OrcError.cpp | 2 +- llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | 2 +- llvm/lib/Object/Error.cpp | 4 ++-- llvm/lib/ProfileData/Coverage/CoverageMapping.cpp | 2 +- llvm/lib/ProfileData/InstrProf.cpp | 2 +- llvm/lib/ProfileData/SampleProf.cpp | 2 +- llvm/lib/Support/Error.cpp | 2 +- llvm/tools/llvm-cxxdump/Error.cpp | 2 +- llvm/tools/llvm-readobj/Error.cpp | 4 ++-- llvm/tools/obj2yaml/Error.cpp | 4 ++-- 19 files changed, 26 insertions(+), 33 deletions(-) diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h index 6f6cd96a..e637afb 100644 --- a/llvm/include/llvm/MC/MCContext.h +++ b/llvm/include/llvm/MC/MCContext.h @@ -578,7 +578,7 @@ namespace llvm { /// allocator supports it). /// \return The allocated memory. Could be NULL. inline void *operator new(size_t Bytes, llvm::MCContext &C, - size_t Alignment = 8) LLVM_NOEXCEPT { + size_t Alignment = 8) noexcept { return C.allocate(Bytes, Alignment); } /// \brief Placement delete companion to the new above. @@ -587,8 +587,7 @@ inline void *operator new(size_t Bytes, llvm::MCContext &C, /// invoking it directly; see the new operator for more details. This operator /// is called implicitly by the compiler if a placement new expression using /// the MCContext throws in the object constructor. -inline void operator delete(void *Ptr, llvm::MCContext &C, - size_t) LLVM_NOEXCEPT { +inline void operator delete(void *Ptr, llvm::MCContext &C, size_t) noexcept { C.deallocate(Ptr); } @@ -612,7 +611,7 @@ inline void operator delete(void *Ptr, llvm::MCContext &C, /// allocator supports it). /// \return The allocated memory. Could be NULL. inline void *operator new[](size_t Bytes, llvm::MCContext &C, - size_t Alignment = 8) LLVM_NOEXCEPT { + size_t Alignment = 8) noexcept { return C.allocate(Bytes, Alignment); } @@ -622,7 +621,7 @@ inline void *operator new[](size_t Bytes, llvm::MCContext &C, /// invoking it directly; see the new[] operator for more details. This operator /// is called implicitly by the compiler if a placement new[] expression using /// the MCContext throws in the object constructor. -inline void operator delete[](void *Ptr, llvm::MCContext &C) LLVM_NOEXCEPT { +inline void operator delete[](void *Ptr, llvm::MCContext &C) noexcept { C.deallocate(Ptr); } diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h index 33a0399..a132dca 100644 --- a/llvm/include/llvm/Support/Compiler.h +++ b/llvm/include/llvm/Support/Compiler.h @@ -73,12 +73,6 @@ #define LLVM_MSC_PREREQ(version) 0 #endif -#if !defined(_MSC_VER) || defined(__clang__) || LLVM_MSC_PREREQ(1900) -#define LLVM_NOEXCEPT noexcept -#else -#define LLVM_NOEXCEPT throw() -#endif - /// \brief Does the compiler support ref-qualifiers for *this? /// /// Sadly, this is separate from just rvalue reference support because GCC diff --git a/llvm/include/llvm/Support/YAMLParser.h b/llvm/include/llvm/Support/YAMLParser.h index 23014fc..dad6740 100644 --- a/llvm/include/llvm/Support/YAMLParser.h +++ b/llvm/include/llvm/Support/YAMLParser.h @@ -144,12 +144,12 @@ public: unsigned int getType() const { return TypeID; } void *operator new(size_t Size, BumpPtrAllocator &Alloc, - size_t Alignment = 16) LLVM_NOEXCEPT { + size_t Alignment = 16) noexcept { return Alloc.Allocate(Size, Alignment); } void operator delete(void *Ptr, BumpPtrAllocator &Alloc, - size_t Size) LLVM_NOEXCEPT { + size_t Size) noexcept { Alloc.Deallocate(Ptr, Size); } @@ -157,7 +157,7 @@ protected: std::unique_ptr &Doc; SMRange SourceRange; - void operator delete(void *) LLVM_NOEXCEPT = delete; + void operator delete(void *) noexcept = delete; ~Node() = default; diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 09118ea..825df2b 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -6581,7 +6581,7 @@ namespace { // will be removed once this transition is complete. Clients should prefer to // deal with the Error value directly, rather than converting to error_code. class BitcodeErrorCategoryType : public std::error_category { - const char *name() const LLVM_NOEXCEPT override { + const char *name() const noexcept override { return "llvm.bitcode"; } std::string message(int IE) const override { diff --git a/llvm/lib/DebugInfo/CodeView/CodeViewError.cpp b/llvm/lib/DebugInfo/CodeView/CodeViewError.cpp index e9678db..55c10c0 100644 --- a/llvm/lib/DebugInfo/CodeView/CodeViewError.cpp +++ b/llvm/lib/DebugInfo/CodeView/CodeViewError.cpp @@ -20,7 +20,7 @@ namespace { // deal with the Error value directly, rather than converting to error_code. class CodeViewErrorCategory : public std::error_category { public: - const char *name() const LLVM_NOEXCEPT override { return "llvm.codeview"; } + const char *name() const noexcept override { return "llvm.codeview"; } std::string message(int Condition) const override { switch (static_cast(Condition)) { diff --git a/llvm/lib/DebugInfo/MSF/MSFError.cpp b/llvm/lib/DebugInfo/MSF/MSFError.cpp index 5272cad..1b8294e 100644 --- a/llvm/lib/DebugInfo/MSF/MSFError.cpp +++ b/llvm/lib/DebugInfo/MSF/MSFError.cpp @@ -20,7 +20,7 @@ namespace { // deal with the Error value directly, rather than converting to error_code. class MSFErrorCategory : public std::error_category { public: - const char *name() const LLVM_NOEXCEPT override { return "llvm.msf"; } + const char *name() const noexcept override { return "llvm.msf"; } std::string message(int Condition) const override { switch (static_cast(Condition)) { diff --git a/llvm/lib/DebugInfo/PDB/DIA/DIAError.cpp b/llvm/lib/DebugInfo/PDB/DIA/DIAError.cpp index 81125d2..0da877b 100644 --- a/llvm/lib/DebugInfo/PDB/DIA/DIAError.cpp +++ b/llvm/lib/DebugInfo/PDB/DIA/DIAError.cpp @@ -10,7 +10,7 @@ using namespace llvm::pdb; // deal with the Error value directly, rather than converting to error_code. class DIAErrorCategory : public std::error_category { public: - const char *name() const LLVM_NOEXCEPT override { return "llvm.pdb.dia"; } + const char *name() const noexcept override { return "llvm.pdb.dia"; } std::string message(int Condition) const override { switch (static_cast(Condition)) { diff --git a/llvm/lib/DebugInfo/PDB/GenericError.cpp b/llvm/lib/DebugInfo/PDB/GenericError.cpp index 4321013..789f3b8 100644 --- a/llvm/lib/DebugInfo/PDB/GenericError.cpp +++ b/llvm/lib/DebugInfo/PDB/GenericError.cpp @@ -20,7 +20,7 @@ namespace { // deal with the Error value directly, rather than converting to error_code. class GenericErrorCategory : public std::error_category { public: - const char *name() const LLVM_NOEXCEPT override { return "llvm.pdb"; } + const char *name() const noexcept override { return "llvm.pdb"; } std::string message(int Condition) const override { switch (static_cast(Condition)) { diff --git a/llvm/lib/DebugInfo/PDB/Raw/RawError.cpp b/llvm/lib/DebugInfo/PDB/Raw/RawError.cpp index cbce890..f4a5057 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/RawError.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/RawError.cpp @@ -11,7 +11,7 @@ namespace { // deal with the Error value directly, rather than converting to error_code. class RawErrorCategory : public std::error_category { public: - const char *name() const LLVM_NOEXCEPT override { return "llvm.pdb.raw"; } + const char *name() const noexcept override { return "llvm.pdb.raw"; } std::string message(int Condition) const override { switch (static_cast(Condition)) { diff --git a/llvm/lib/ExecutionEngine/Orc/OrcError.cpp b/llvm/lib/ExecutionEngine/Orc/OrcError.cpp index 22f1303..64472f9 100644 --- a/llvm/lib/ExecutionEngine/Orc/OrcError.cpp +++ b/llvm/lib/ExecutionEngine/Orc/OrcError.cpp @@ -25,7 +25,7 @@ namespace { // deal with the Error value directly, rather than converting to error_code. class OrcErrorCategory : public std::error_category { public: - const char *name() const LLVM_NOEXCEPT override { return "orc"; } + const char *name() const noexcept override { return "orc"; } std::string message(int condition) const override { switch (static_cast(condition)) { diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index 0c69b1a..82b582a 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -39,7 +39,7 @@ enum RuntimeDyldErrorCode { // deal with the Error value directly, rather than converting to error_code. class RuntimeDyldErrorCategory : public std::error_category { public: - const char *name() const LLVM_NOEXCEPT override { return "runtimedyld"; } + const char *name() const noexcept override { return "runtimedyld"; } std::string message(int Condition) const override { switch (static_cast(Condition)) { diff --git a/llvm/lib/Object/Error.cpp b/llvm/lib/Object/Error.cpp index 2357526..c1dfe67 100644 --- a/llvm/lib/Object/Error.cpp +++ b/llvm/lib/Object/Error.cpp @@ -24,12 +24,12 @@ namespace { // deal with the Error value directly, rather than converting to error_code. class _object_error_category : public std::error_category { public: - const char* name() const LLVM_NOEXCEPT override; + const char* name() const noexcept override; std::string message(int ev) const override; }; } -const char *_object_error_category::name() const LLVM_NOEXCEPT { +const char *_object_error_category::name() const noexcept { return "llvm.object"; } diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp index 2d800a3..6d907c7 100644 --- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp +++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp @@ -589,7 +589,7 @@ std::string getCoverageMapErrString(coveragemap_error Err) { // will be removed once this transition is complete. Clients should prefer to // deal with the Error value directly, rather than converting to error_code. class CoverageMappingErrorCategoryType : public std::error_category { - const char *name() const LLVM_NOEXCEPT override { return "llvm.coveragemap"; } + const char *name() const noexcept override { return "llvm.coveragemap"; } std::string message(int IE) const override { return getCoverageMapErrString(static_cast(IE)); } diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp index b512f54..77c6ffc 100644 --- a/llvm/lib/ProfileData/InstrProf.cpp +++ b/llvm/lib/ProfileData/InstrProf.cpp @@ -80,7 +80,7 @@ std::string getInstrProfErrString(instrprof_error Err) { // will be removed once this transition is complete. Clients should prefer to // deal with the Error value directly, rather than converting to error_code. class InstrProfErrorCategoryType : public std::error_category { - const char *name() const LLVM_NOEXCEPT override { return "llvm.instrprof"; } + const char *name() const noexcept override { return "llvm.instrprof"; } std::string message(int IE) const override { return getInstrProfErrString(static_cast(IE)); } diff --git a/llvm/lib/ProfileData/SampleProf.cpp b/llvm/lib/ProfileData/SampleProf.cpp index cb02461..5bcfff08 100644 --- a/llvm/lib/ProfileData/SampleProf.cpp +++ b/llvm/lib/ProfileData/SampleProf.cpp @@ -24,7 +24,7 @@ namespace { // will be removed once this transition is complete. Clients should prefer to // deal with the Error value directly, rather than converting to error_code. class SampleProfErrorCategoryType : public std::error_category { - const char *name() const LLVM_NOEXCEPT override { return "llvm.sampleprof"; } + const char *name() const noexcept override { return "llvm.sampleprof"; } std::string message(int IE) const override { sampleprof_error E = static_cast(IE); switch (E) { diff --git a/llvm/lib/Support/Error.cpp b/llvm/lib/Support/Error.cpp index 28d9127..7436a1f 100644 --- a/llvm/lib/Support/Error.cpp +++ b/llvm/lib/Support/Error.cpp @@ -28,7 +28,7 @@ namespace { // deal with the Error value directly, rather than converting to error_code. class ErrorErrorCategory : public std::error_category { public: - const char *name() const LLVM_NOEXCEPT override { return "Error"; } + const char *name() const noexcept override { return "Error"; } std::string message(int condition) const override { switch (static_cast(condition)) { diff --git a/llvm/tools/llvm-cxxdump/Error.cpp b/llvm/tools/llvm-cxxdump/Error.cpp index ff9f0f5..d59547e 100644 --- a/llvm/tools/llvm-cxxdump/Error.cpp +++ b/llvm/tools/llvm-cxxdump/Error.cpp @@ -22,7 +22,7 @@ namespace { // deal with the Error value directly, rather than converting to error_code. class cxxdump_error_category : public std::error_category { public: - const char *name() const LLVM_NOEXCEPT override { return "llvm.cxxdump"; } + const char *name() const noexcept override { return "llvm.cxxdump"; } std::string message(int ev) const override { switch (static_cast(ev)) { case cxxdump_error::success: diff --git a/llvm/tools/llvm-readobj/Error.cpp b/llvm/tools/llvm-readobj/Error.cpp index 492eb33..03d3494 100644 --- a/llvm/tools/llvm-readobj/Error.cpp +++ b/llvm/tools/llvm-readobj/Error.cpp @@ -22,12 +22,12 @@ namespace { // deal with the Error value directly, rather than converting to error_code. class _readobj_error_category : public std::error_category { public: - const char* name() const LLVM_NOEXCEPT override; + const char* name() const noexcept override; std::string message(int ev) const override; }; } // namespace -const char *_readobj_error_category::name() const LLVM_NOEXCEPT { +const char *_readobj_error_category::name() const noexcept { return "llvm.readobj"; } diff --git a/llvm/tools/obj2yaml/Error.cpp b/llvm/tools/obj2yaml/Error.cpp index 9d1af68..399b563 100644 --- a/llvm/tools/obj2yaml/Error.cpp +++ b/llvm/tools/obj2yaml/Error.cpp @@ -18,12 +18,12 @@ namespace { // deal with the Error value directly, rather than converting to error_code. class _obj2yaml_error_category : public std::error_category { public: - const char *name() const LLVM_NOEXCEPT override; + const char *name() const noexcept override; std::string message(int ev) const override; }; } // namespace -const char *_obj2yaml_error_category::name() const LLVM_NOEXCEPT { +const char *_obj2yaml_error_category::name() const noexcept { return "obj2yaml"; } -- 2.7.4