diff options
Diffstat (limited to 'llvm/include/llvm/Support')
-rw-r--r-- | llvm/include/llvm/Support/BinaryStreamWriter.h | 4 | ||||
-rw-r--r-- | llvm/include/llvm/Support/DebugCounter.h | 3 | ||||
-rw-r--r-- | llvm/include/llvm/Support/Format.h | 15 | ||||
-rw-r--r-- | llvm/include/llvm/Support/ScopedPrinter.h | 6 | ||||
-rw-r--r-- | llvm/include/llvm/Support/SpecialCaseList.h | 16 |
5 files changed, 33 insertions, 11 deletions
diff --git a/llvm/include/llvm/Support/BinaryStreamWriter.h b/llvm/include/llvm/Support/BinaryStreamWriter.h index dddf53b..39ce0b6 100644 --- a/llvm/include/llvm/Support/BinaryStreamWriter.h +++ b/llvm/include/llvm/Support/BinaryStreamWriter.h @@ -10,6 +10,7 @@ #define LLVM_SUPPORT_BINARYSTREAMWRITER_H #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/STLForwardCompat.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/BinaryStreamArray.h" #include "llvm/Support/BinaryStreamError.h" @@ -69,8 +70,7 @@ public: static_assert(std::is_enum<T>::value, "Cannot call writeEnum with non-Enum type"); - using U = std::underlying_type_t<T>; - return writeInteger<U>(static_cast<U>(Num)); + return writeInteger(llvm::to_underlying(Num)); } /// Write the unsigned integer Value to the underlying stream using ULEB128 diff --git a/llvm/include/llvm/Support/DebugCounter.h b/llvm/include/llvm/Support/DebugCounter.h index 48fc600..39a08d4 100644 --- a/llvm/include/llvm/Support/DebugCounter.h +++ b/llvm/include/llvm/Support/DebugCounter.h @@ -178,6 +178,7 @@ protected: std::string Desc; SmallVector<Chunk> Chunks; }; + bool handleCounterIncrement(CounterInfo &Info); DenseMap<unsigned, CounterInfo> Counters; CounterVector RegisteredCounters; @@ -188,6 +189,8 @@ protected: bool ShouldPrintCounter = false; + bool ShouldPrintCounterQueries = false; + bool BreakOnLast = false; }; diff --git a/llvm/include/llvm/Support/Format.h b/llvm/include/llvm/Support/Format.h index 34b224d..b549341 100644 --- a/llvm/include/llvm/Support/Format.h +++ b/llvm/include/llvm/Support/Format.h @@ -78,9 +78,20 @@ public: /// printed, this synthesizes the string into a temporary buffer provided and /// returns whether or not it is big enough. +namespace detail { +template <typename T> struct decay_if_c_char_array { + using type = T; +}; +template <std::size_t N> struct decay_if_c_char_array<char[N]> { + using type = const char *; +}; +template <typename T> +using decay_if_c_char_array_t = typename decay_if_c_char_array<T>::type; +} // namespace detail + template <typename... Ts> class format_object final : public format_object_base { - std::tuple<Ts...> Vals; + std::tuple<detail::decay_if_c_char_array_t<Ts>...> Vals; template <std::size_t... Is> int snprint_tuple(char *Buffer, unsigned BufferSize, @@ -96,7 +107,7 @@ public: format_object(const char *fmt, const Ts &... vals) : format_object_base(fmt), Vals(vals...) { static_assert( - (std::is_scalar_v<Ts> && ...), + (std::is_scalar_v<detail::decay_if_c_char_array_t<Ts>> && ...), "format can't be used with non fundamental / non pointer type"); } diff --git a/llvm/include/llvm/Support/ScopedPrinter.h b/llvm/include/llvm/Support/ScopedPrinter.h index 94080e8..7b87fda 100644 --- a/llvm/include/llvm/Support/ScopedPrinter.h +++ b/llvm/include/llvm/Support/ScopedPrinter.h @@ -11,6 +11,7 @@ #include "llvm/ADT/APSInt.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/STLForwardCompat.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringRef.h" @@ -57,8 +58,7 @@ struct HexNumber { HexNumber(unsigned long Value) : Value(Value) {} HexNumber(unsigned long long Value) : Value(Value) {} template <typename EnumT, typename = std::enable_if_t<std::is_enum_v<EnumT>>> - HexNumber(EnumT Value) - : HexNumber(static_cast<std::underlying_type_t<EnumT>>(Value)) {} + HexNumber(EnumT Value) : HexNumber(llvm::to_underlying(Value)) {} uint64_t Value; }; @@ -84,7 +84,7 @@ struct FlagEntry { : Name(Name), Value(Value) {} template <typename EnumT, typename = std::enable_if_t<std::is_enum_v<EnumT>>> FlagEntry(StringRef Name, EnumT Value) - : FlagEntry(Name, static_cast<std::underlying_type_t<EnumT>>(Value)) {} + : FlagEntry(Name, llvm::to_underlying(Value)) {} StringRef Name; uint64_t Value; diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h index 466e2a4..ead7655 100644 --- a/llvm/include/llvm/Support/SpecialCaseList.h +++ b/llvm/include/llvm/Support/SpecialCaseList.h @@ -115,7 +115,8 @@ protected: // classes. LLVM_ABI bool createInternal(const std::vector<std::string> &Paths, vfs::FileSystem &VFS, std::string &Error); - LLVM_ABI bool createInternal(const MemoryBuffer *MB, std::string &Error); + LLVM_ABI bool createInternal(const MemoryBuffer *MB, std::string &Error, + bool OrderBySize = false); SpecialCaseList() = default; SpecialCaseList(SpecialCaseList const &) = delete; @@ -126,6 +127,8 @@ private: class RegexMatcher { public: LLVM_ABI Error insert(StringRef Pattern, unsigned LineNumber); + LLVM_ABI void preprocess(bool BySize); + LLVM_ABI void match(StringRef Query, llvm::function_ref<void(StringRef Rule, unsigned LineNo)> Cb) const; @@ -144,6 +147,8 @@ private: class GlobMatcher { public: LLVM_ABI Error insert(StringRef Pattern, unsigned LineNumber); + LLVM_ABI void preprocess(bool BySize); + LLVM_ABI void match(StringRef Query, llvm::function_ref<void(StringRef Rule, unsigned LineNo)> Cb) const; @@ -164,6 +169,9 @@ private: public: LLVM_ABI Matcher(bool UseGlobs, bool RemoveDotSlash); + LLVM_ABI Error insert(StringRef Pattern, unsigned LineNumber); + LLVM_ABI void preprocess(bool BySize); + LLVM_ABI void match(StringRef Query, llvm::function_ref<void(StringRef Rule, unsigned LineNo)> Cb) const; @@ -174,8 +182,6 @@ private: return R; } - LLVM_ABI Error insert(StringRef Pattern, unsigned LineNumber); - std::variant<RegexMatcher, GlobMatcher> M; bool RemoveDotSlash; }; @@ -206,6 +212,8 @@ protected: StringRef Category) const; private: + friend class SpecialCaseList; + LLVM_ABI void preprocess(bool OrderBySize); LLVM_ABI const SpecialCaseList::Matcher * findMatcher(StringRef Prefix, StringRef Category) const; }; @@ -222,7 +230,7 @@ private: /// Parses just-constructed SpecialCaseList entries from a memory buffer. LLVM_ABI bool parse(unsigned FileIdx, const MemoryBuffer *MB, - std::string &Error); + std::string &Error, bool OrderBySize); }; } // namespace llvm |