diff --git a/include/llvm-dialects/TableGen/Format.h b/include/llvm-dialects/TableGen/Format.h
index 0f099a0..9dd62cd 100644
--- a/include/llvm-dialects/TableGen/Format.h
+++ b/include/llvm-dialects/TableGen/Format.h
@@ -35,6 +35,13 @@
namespace llvm_dialects {
+namespace llvm_support_detail =
+#if !defined(LLVM_MAIN_REVISION) || LLVM_MAIN_REVISION >= 494496
+ llvm::support::detail;
+#else
+ llvm::detail;
+#endif
+
/// Format context containing substitutions for special placeholders.
///
/// This context divides special placeholders into two categories: builtin ones
@@ -185,14 +192,14 @@ class FmtObjectBase {
// std::vector.
struct CreateAdapters {
template
- std::vector operator()(Ts &...items) {
- return std::vector{&items...};
+ std::vector operator()(Ts &...items) {
+ return std::vector{&items...};
}
};
llvm::StringRef fmt;
const FmtContext *context;
- std::vector adapters;
+ std::vector adapters;
std::vector replacements;
public:
@@ -253,7 +260,7 @@ template class FmtObject : public FmtObjectBase {
class FmtStrVecObject : public FmtObjectBase {
public:
using StrFormatAdapter =
- decltype(llvm::detail::build_format_adapter(std::declval()));
+ decltype(llvm_support_detail::build_format_adapter(std::declval()));
FmtStrVecObject(llvm::StringRef fmt, const FmtContext *ctx,
llvm::ArrayRef params);
@@ -313,13 +320,13 @@ class FmtStrVecObject : public FmtObjectBase {
template
inline auto tgfmt(llvm::StringRef fmt, const FmtContext *ctx, Ts &&...vals)
-> FmtObject(vals))...))> {
+ llvm_support_detail::build_format_adapter(std::forward(vals))...))> {
using ParamTuple = decltype(std::make_tuple(
- llvm::detail::build_format_adapter(std::forward(vals))...));
+ llvm_support_detail::build_format_adapter(std::forward(vals))...));
return FmtObject(
fmt, ctx,
std::make_tuple(
- llvm::detail::build_format_adapter(std::forward(vals))...));
+ llvm_support_detail::build_format_adapter(std::forward(vals))...));
}
inline FmtStrVecObject tgfmt(llvm::StringRef fmt, const FmtContext *ctx,
diff --git a/lib/TableGen/Format.cpp b/lib/TableGen/Format.cpp
index 31ef282..a55cef9 100644
--- a/lib/TableGen/Format.cpp
+++ b/lib/TableGen/Format.cpp
@@ -218,7 +218,7 @@ void FmtObjectBase::format(raw_ostream &s) const {
s << repl.spec << kMarkerForNoSubst;
continue;
}
- auto range = ArrayRef(adapters);
+ auto range = ArrayRef(adapters);
range = range.drop_front(repl.index);
llvm::interleaveComma(range, s,
[&](auto &x) { x->format(s, /*Options=*/""); });
@@ -254,7 +254,7 @@ FmtStrVecObject::FmtStrVecObject(StringRef fmt, const FmtContext *ctx,
: FmtObjectBase(fmt, ctx, params.size()) {
parameters.reserve(params.size());
for (std::string p : params)
- parameters.push_back(llvm::detail::build_format_adapter(std::move(p)));
+ parameters.push_back(llvm_support_detail::build_format_adapter(std::move(p)));
adapters.reserve(parameters.size());
for (auto &p : parameters)