diff options
Diffstat (limited to 'llvm/include/llvm/Support')
-rw-r--r-- | llvm/include/llvm/Support/Alignment.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/Support/Casting.h | 7 | ||||
-rw-r--r-- | llvm/include/llvm/Support/CommandLine.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/Support/DOTGraphTraits.h | 5 | ||||
-rw-r--r-- | llvm/include/llvm/Support/DebugLog.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/Support/ELFAttrParserCompact.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/Support/ELFAttrParserExtended.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/Support/ELFAttributes.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/Support/FormatAdapters.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/Support/GraphWriter.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/Support/LSP/Protocol.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/Support/MD5.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/Support/MathExtras.h | 57 | ||||
-rw-r--r-- | llvm/include/llvm/Support/ScopedPrinter.h | 4 | ||||
-rw-r--r-- | llvm/include/llvm/Support/SuffixTreeNode.h | 4 | ||||
-rw-r--r-- | llvm/include/llvm/Support/Timer.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/Support/VirtualFileSystem.h | 4 | ||||
-rw-r--r-- | llvm/include/llvm/Support/VirtualOutputFile.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/Support/raw_socket_stream.h | 2 |
19 files changed, 46 insertions, 61 deletions
diff --git a/llvm/include/llvm/Support/Alignment.h b/llvm/include/llvm/Support/Alignment.h index a4ca54e..f9d7c76 100644 --- a/llvm/include/llvm/Support/Alignment.h +++ b/llvm/include/llvm/Support/Alignment.h @@ -103,7 +103,7 @@ inline Align assumeAligned(uint64_t Value) { /// This struct is a compact representation of a valid (power of two) or /// undefined (0) alignment. -struct MaybeAlign : public std::optional<Align> { +struct MaybeAlign : std::optional<Align> { private: using UP = std::optional<Align>; diff --git a/llvm/include/llvm/Support/Casting.h b/llvm/include/llvm/Support/Casting.h index 2a9a149..6f6df2e 100644 --- a/llvm/include/llvm/Support/Casting.h +++ b/llvm/include/llvm/Support/Casting.h @@ -340,7 +340,7 @@ struct ValueFromPointerCast /// during the cast. It's also a good example of how to implement a move-only /// cast. template <typename To, typename From, typename Derived = void> -struct UniquePtrCast : public CastIsPossible<To, From *> { +struct UniquePtrCast : CastIsPossible<To, From *> { using Self = detail::SelfType<Derived, UniquePtrCast<To, From>>; using CastResultType = std::unique_ptr< std::remove_reference_t<typename cast_retty<To, From>::ret_type>>; @@ -473,7 +473,7 @@ struct ForwardToPointerCast { // take advantage of the cast traits whenever possible! template <typename To, typename From, typename Enable = void> -struct CastInfo : public CastIsPossible<To, From> { +struct CastInfo : CastIsPossible<To, From> { using Self = CastInfo<To, From, Enable>; using CastReturnType = typename cast_retty<To, From>::ret_type; @@ -536,8 +536,7 @@ struct CastInfo<To, std::unique_ptr<From>> : public UniquePtrCast<To, From> {}; /// the input is std::optional<From> that the output can be std::optional<To>. /// If that's not the case, specialize CastInfo for your use case. template <typename To, typename From> -struct CastInfo<To, std::optional<From>> : public OptionalValueCast<To, From> { -}; +struct CastInfo<To, std::optional<From>> : OptionalValueCast<To, From> {}; /// isa<X> - Return true if the parameter to the template is an instance of one /// of the template type arguments. Used like this: diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h index dd05c53..5a5f00e 100644 --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -549,7 +549,7 @@ template <class DataType> struct OptionValue; // The default value safely does nothing. Option value printing is only // best-effort. template <class DataType, bool isClass> -struct OptionValueBase : public GenericOptionValue { +struct OptionValueBase : GenericOptionValue { // Temporary storage for argument passing. using WrapperType = OptionValue<DataType>; diff --git a/llvm/include/llvm/Support/DOTGraphTraits.h b/llvm/include/llvm/Support/DOTGraphTraits.h index ffa9abe..3b9fe00 100644 --- a/llvm/include/llvm/Support/DOTGraphTraits.h +++ b/llvm/include/llvm/Support/DOTGraphTraits.h @@ -162,9 +162,8 @@ public: /// graphs are converted to 'dot' graphs. When specializing, you may inherit /// from DefaultDOTGraphTraits if you don't need to override everything. /// -template <typename Ty> -struct DOTGraphTraits : public DefaultDOTGraphTraits { - DOTGraphTraits (bool simple=false) : DefaultDOTGraphTraits (simple) {} +template <typename Ty> struct DOTGraphTraits : DefaultDOTGraphTraits { + using DefaultDOTGraphTraits::DefaultDOTGraphTraits; }; } // End llvm namespace diff --git a/llvm/include/llvm/Support/DebugLog.h b/llvm/include/llvm/Support/DebugLog.h index fd67d7a..e9bd2d8 100644 --- a/llvm/include/llvm/Support/DebugLog.h +++ b/llvm/include/llvm/Support/DebugLog.h @@ -293,7 +293,7 @@ class RAIINewLineStream final : public raw_ostream { public: RAIINewLineStream(raw_ostream &Os) : Os(Os) { SetUnbuffered(); } - ~RAIINewLineStream() { Os << '\n'; } + ~RAIINewLineStream() override { Os << '\n'; } void write_impl(const char *Ptr, size_t Size) final { Os.write(Ptr, Size); } uint64_t current_pos() const final { return Os.tell(); } RAIINewLineStream &asLvalue() { return *this; } diff --git a/llvm/include/llvm/Support/ELFAttrParserCompact.h b/llvm/include/llvm/Support/ELFAttrParserCompact.h index e687483..9bed36f 100644 --- a/llvm/include/llvm/Support/ELFAttrParserCompact.h +++ b/llvm/include/llvm/Support/ELFAttrParserCompact.h @@ -49,7 +49,7 @@ protected: } public: - virtual ~ELFCompactAttrParser() { static_cast<void>(!cursor.takeError()); } + ~ELFCompactAttrParser() override { static_cast<void>(!cursor.takeError()); } Error integerAttribute(unsigned tag); Error stringAttribute(unsigned tag); diff --git a/llvm/include/llvm/Support/ELFAttrParserExtended.h b/llvm/include/llvm/Support/ELFAttrParserExtended.h index 1da6665..d3dc742 100644 --- a/llvm/include/llvm/Support/ELFAttrParserExtended.h +++ b/llvm/include/llvm/Support/ELFAttrParserExtended.h @@ -36,7 +36,7 @@ protected: const unsigned Tag); public: - virtual ~ELFExtendedAttrParser() { static_cast<void>(!Cursor.takeError()); } + ~ELFExtendedAttrParser() override { static_cast<void>(!Cursor.takeError()); } Error parse(ArrayRef<uint8_t> Section, llvm::endianness Endian) override; std::optional<unsigned> getAttributeValue(unsigned Tag) const override; diff --git a/llvm/include/llvm/Support/ELFAttributes.h b/llvm/include/llvm/Support/ELFAttributes.h index 270246f..5771a84 100644 --- a/llvm/include/llvm/Support/ELFAttributes.h +++ b/llvm/include/llvm/Support/ELFAttributes.h @@ -48,8 +48,6 @@ struct SubsectionAndTagToTagName { StringRef SubsectionName; unsigned Tag; StringRef TagName; - SubsectionAndTagToTagName(StringRef SN, unsigned Tg, StringRef TN) - : SubsectionName(SN), Tag(Tg), TagName(TN) {} }; namespace ELFAttrs { diff --git a/llvm/include/llvm/Support/FormatAdapters.h b/llvm/include/llvm/Support/FormatAdapters.h index 4131e95..91e9c41 100644 --- a/llvm/include/llvm/Support/FormatAdapters.h +++ b/llvm/include/llvm/Support/FormatAdapters.h @@ -77,7 +77,7 @@ class ErrorAdapter : public FormatAdapter<Error> { public: ErrorAdapter(Error &&Item) : FormatAdapter(std::move(Item)) {} ErrorAdapter(ErrorAdapter &&) = default; - ~ErrorAdapter() { consumeError(std::move(Item)); } + ~ErrorAdapter() override { consumeError(std::move(Item)); } void format(llvm::raw_ostream &Stream, StringRef Style) override { Stream << Item; } diff --git a/llvm/include/llvm/Support/GraphWriter.h b/llvm/include/llvm/Support/GraphWriter.h index a8784ed..3bef75c 100644 --- a/llvm/include/llvm/Support/GraphWriter.h +++ b/llvm/include/llvm/Support/GraphWriter.h @@ -343,7 +343,7 @@ public: const void *DestNodeID, int DestNodePort, const std::string &Attrs) { if (SrcNodePort > 64) return; // Eminating from truncated part? - if (DestNodePort > 64) DestNodePort = 64; // Targeting the truncated part? + DestNodePort = std::min(DestNodePort, 64); // Targeting the truncated part? O << "\tNode" << SrcNodeID; if (SrcNodePort >= 0) diff --git a/llvm/include/llvm/Support/LSP/Protocol.h b/llvm/include/llvm/Support/LSP/Protocol.h index 93b82f1..e38203a 100644 --- a/llvm/include/llvm/Support/LSP/Protocol.h +++ b/llvm/include/llvm/Support/LSP/Protocol.h @@ -449,7 +449,7 @@ struct ReferenceContext { bool fromJSON(const llvm::json::Value &value, ReferenceContext &result, llvm::json::Path path); -struct ReferenceParams : public TextDocumentPositionParams { +struct ReferenceParams : TextDocumentPositionParams { ReferenceContext context; }; diff --git a/llvm/include/llvm/Support/MD5.h b/llvm/include/llvm/Support/MD5.h index ed29826..4ba3867 100644 --- a/llvm/include/llvm/Support/MD5.h +++ b/llvm/include/llvm/Support/MD5.h @@ -41,7 +41,7 @@ template <typename T> class ArrayRef; class MD5 { public: - struct MD5Result : public std::array<uint8_t, 16> { + struct MD5Result : std::array<uint8_t, 16> { LLVM_ABI SmallString<32> digest() const; uint64_t low() const { diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h index c2716a9..9bbb8a2 100644 --- a/llvm/include/llvm/Support/MathExtras.h +++ b/llvm/include/llvm/Support/MathExtras.h @@ -13,6 +13,7 @@ #ifndef LLVM_SUPPORT_MATHEXTRAS_H #define LLVM_SUPPORT_MATHEXTRAS_H +#include "llvm/ADT/STLForwardCompat.h" #include "llvm/ADT/bit.h" #include "llvm/Support/Compiler.h" #include <cassert> @@ -42,38 +43,28 @@ using common_sint = /// Mathematical constants. namespace numbers { -// TODO: Track C++20 std::numbers. // clang-format off -constexpr double e = 0x1.5bf0a8b145769P+1, // (2.7182818284590452354) https://oeis.org/A001113 - egamma = 0x1.2788cfc6fb619P-1, // (.57721566490153286061) https://oeis.org/A001620 - ln2 = 0x1.62e42fefa39efP-1, // (.69314718055994530942) https://oeis.org/A002162 - ln10 = 0x1.26bb1bbb55516P+1, // (2.3025850929940456840) https://oeis.org/A002392 - log2e = 0x1.71547652b82feP+0, // (1.4426950408889634074) - log10e = 0x1.bcb7b1526e50eP-2, // (.43429448190325182765) - pi = 0x1.921fb54442d18P+1, // (3.1415926535897932385) https://oeis.org/A000796 - inv_pi = 0x1.45f306dc9c883P-2, // (.31830988618379067154) https://oeis.org/A049541 - sqrtpi = 0x1.c5bf891b4ef6bP+0, // (1.7724538509055160273) https://oeis.org/A002161 - inv_sqrtpi = 0x1.20dd750429b6dP-1, // (.56418958354775628695) https://oeis.org/A087197 - sqrt2 = 0x1.6a09e667f3bcdP+0, // (1.4142135623730950488) https://oeis.org/A00219 - inv_sqrt2 = 0x1.6a09e667f3bcdP-1, // (.70710678118654752440) - sqrt3 = 0x1.bb67ae8584caaP+0, // (1.7320508075688772935) https://oeis.org/A002194 - inv_sqrt3 = 0x1.279a74590331cP-1, // (.57735026918962576451) - phi = 0x1.9e3779b97f4a8P+0; // (1.6180339887498948482) https://oeis.org/A001622 -constexpr float ef = 0x1.5bf0a8P+1F, // (2.71828183) https://oeis.org/A001113 - egammaf = 0x1.2788d0P-1F, // (.577215665) https://oeis.org/A001620 - ln2f = 0x1.62e430P-1F, // (.693147181) https://oeis.org/A002162 - ln10f = 0x1.26bb1cP+1F, // (2.30258509) https://oeis.org/A002392 - log2ef = 0x1.715476P+0F, // (1.44269504) - log10ef = 0x1.bcb7b2P-2F, // (.434294482) - pif = 0x1.921fb6P+1F, // (3.14159265) https://oeis.org/A000796 - inv_pif = 0x1.45f306P-2F, // (.318309886) https://oeis.org/A049541 - sqrtpif = 0x1.c5bf8aP+0F, // (1.77245385) https://oeis.org/A002161 - inv_sqrtpif = 0x1.20dd76P-1F, // (.564189584) https://oeis.org/A087197 - sqrt2f = 0x1.6a09e6P+0F, // (1.41421356) https://oeis.org/A002193 - inv_sqrt2f = 0x1.6a09e6P-1F, // (.707106781) - sqrt3f = 0x1.bb67aeP+0F, // (1.73205081) https://oeis.org/A002194 - inv_sqrt3f = 0x1.279a74P-1F, // (.577350269) - phif = 0x1.9e377aP+0F; // (1.61803399) https://oeis.org/A001622 +inline constexpr float ef = e_v<float>; +inline constexpr float egammaf = egamma_v<float>; +inline constexpr float ln2f = ln2_v<float>; +inline constexpr float ln10f = ln10_v<float>; +inline constexpr float log2ef = log2e_v<float>; +inline constexpr float log10ef = log10e_v<float>; +inline constexpr float pif = pi_v<float>; +inline constexpr float inv_pif = inv_pi_v<float>; +inline constexpr float inv_sqrtpif = inv_sqrtpi_v<float>; +inline constexpr float sqrt2f = sqrt2_v<float>; +inline constexpr float inv_sqrt2f = inv_sqrt2_v<float>; +inline constexpr float sqrt3f = sqrt3_v<float>; +inline constexpr float inv_sqrt3f = inv_sqrt3_v<float>; +inline constexpr float phif = phi_v<float>; + +// sqrtpi is not in C++20 std::numbers. +template <typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>> +inline constexpr T sqrtpi_v = T(0x1.c5bf891b4ef6bP+0); // (1.7724538509055160273) https://oeis.org/A002161 +inline constexpr double sqrtpi = sqrtpi_v<double>; +inline constexpr float sqrtpif = sqrtpi_v<float>; + // These string literals are taken from below: // https://github.com/bminor/glibc/blob/8543577b04ded6d979ffcc5a818930e4d74d0645/math/math.h#L1215-L1229 constexpr const char *pis = "3.141592653589793238462643383279502884", @@ -325,11 +316,9 @@ inline bool isShiftedMask_64(uint64_t Value, unsigned &MaskIdx, /// Valid only for positive powers of two. template <size_t kValue> constexpr size_t ConstantLog2() { static_assert(llvm::isPowerOf2_64(kValue), "Value is not a valid power of 2"); - return 1 + ConstantLog2<kValue / 2>(); + return llvm::countr_zero_constexpr(kValue); } -template <> constexpr size_t ConstantLog2<1>() { return 0; } - template <size_t kValue> LLVM_DEPRECATED("Use ConstantLog2 instead", "ConstantLog2") constexpr size_t CTLog2() { diff --git a/llvm/include/llvm/Support/ScopedPrinter.h b/llvm/include/llvm/Support/ScopedPrinter.h index 7b87fda..e9e9903 100644 --- a/llvm/include/llvm/Support/ScopedPrinter.h +++ b/llvm/include/llvm/Support/ScopedPrinter.h @@ -870,7 +870,7 @@ struct DictScope : DelimitedScope { W.objectBegin(); } - ~DictScope() { + ~DictScope() override { if (W) W->objectEnd(); } @@ -889,7 +889,7 @@ struct ListScope : DelimitedScope { W.arrayBegin(); } - ~ListScope() { + ~ListScope() override { if (W) W->arrayEnd(); } diff --git a/llvm/include/llvm/Support/SuffixTreeNode.h b/llvm/include/llvm/Support/SuffixTreeNode.h index b49febf..c3c0bf5 100644 --- a/llvm/include/llvm/Support/SuffixTreeNode.h +++ b/llvm/include/llvm/Support/SuffixTreeNode.h @@ -155,7 +155,7 @@ public: : SuffixTreeNode(NodeKind::ST_Internal, StartIdx), EndIdx(EndIdx), Link(Link) {} - virtual ~SuffixTreeInternalNode() = default; + ~SuffixTreeInternalNode() override = default; }; // A node representing a suffix. @@ -189,7 +189,7 @@ public: SuffixTreeLeafNode(unsigned StartIdx, unsigned *EndIdx) : SuffixTreeNode(NodeKind::ST_Leaf, StartIdx), EndIdx(EndIdx) {} - virtual ~SuffixTreeLeafNode() = default; + ~SuffixTreeLeafNode() override = default; }; } // namespace llvm #endif // LLVM_SUPPORT_SUFFIXTREE_NODE_H diff --git a/llvm/include/llvm/Support/Timer.h b/llvm/include/llvm/Support/Timer.h index 40709d4..a4ed712 100644 --- a/llvm/include/llvm/Support/Timer.h +++ b/llvm/include/llvm/Support/Timer.h @@ -167,7 +167,7 @@ public: /// you to declare a new timer, AND specify the region to time, all in one /// statement. All timers with the same name are merged. This is primarily /// used for debugging and for hunting performance problems. -struct NamedRegionTimer : public TimeRegion { +struct NamedRegionTimer : TimeRegion { LLVM_ABI explicit NamedRegionTimer(StringRef Name, StringRef Description, StringRef GroupName, StringRef GroupDescription, diff --git a/llvm/include/llvm/Support/VirtualFileSystem.h b/llvm/include/llvm/Support/VirtualFileSystem.h index 8007f3c..c8911a0 100644 --- a/llvm/include/llvm/Support/VirtualFileSystem.h +++ b/llvm/include/llvm/Support/VirtualFileSystem.h @@ -268,7 +268,7 @@ class LLVM_ABI FileSystem : public llvm::ThreadSafeRefCountedBase<FileSystem>, public RTTIExtends<FileSystem, RTTIRoot> { public: static const char ID; - virtual ~FileSystem(); + ~FileSystem() override; /// Get the status of the entry at \p Path, if one exists. virtual llvm::ErrorOr<Status> status(const Twine &Path) = 0; @@ -495,7 +495,7 @@ protected: private: IntrusiveRefCntPtr<FileSystem> FS; - virtual void anchor() override; + void anchor() override; }; namespace detail { diff --git a/llvm/include/llvm/Support/VirtualOutputFile.h b/llvm/include/llvm/Support/VirtualOutputFile.h index cb6d1c3..dd50437 100644 --- a/llvm/include/llvm/Support/VirtualOutputFile.h +++ b/llvm/include/llvm/Support/VirtualOutputFile.h @@ -31,7 +31,7 @@ class OutputFileImpl : public RTTIExtends<OutputFileImpl, RTTIRoot> { public: static char ID; - virtual ~OutputFileImpl() = default; + ~OutputFileImpl() override = default; virtual Error keep() = 0; virtual Error discard() = 0; diff --git a/llvm/include/llvm/Support/raw_socket_stream.h b/llvm/include/llvm/Support/raw_socket_stream.h index 47352e3..2abff25 100644 --- a/llvm/include/llvm/Support/raw_socket_stream.h +++ b/llvm/include/llvm/Support/raw_socket_stream.h @@ -126,7 +126,7 @@ class LLVM_ABI raw_socket_stream : public raw_fd_stream { public: raw_socket_stream(int SocketFD); - ~raw_socket_stream(); + ~raw_socket_stream() override; /// Create a \p raw_socket_stream connected to the UNIX domain socket at \p /// SocketPath. |