aboutsummaryrefslogtreecommitdiff
path: root/llvm/include/llvm/Support
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include/llvm/Support')
-rw-r--r--llvm/include/llvm/Support/DebugCounter.h3
-rw-r--r--llvm/include/llvm/Support/Format.h15
-rw-r--r--llvm/include/llvm/Support/SpecialCaseList.h16
3 files changed, 28 insertions, 6 deletions
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/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