Skip to content

Commit

Permalink
Remove LLVM_MAIN_REVISION guard
Browse files Browse the repository at this point in the history
Should not be required anymore.
  • Loading branch information
Thomas Symalla committed Oct 7, 2024
1 parent c436594 commit ca7675f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
31 changes: 13 additions & 18 deletions include/llvm-dialects/TableGen/Format.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@

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
Expand Down Expand Up @@ -192,14 +185,15 @@ class FmtObjectBase {
// std::vector<Base*>.
struct CreateAdapters {
template <typename... Ts>
std::vector<llvm_support_detail::format_adapter *> operator()(Ts &...items) {
return std::vector<llvm_support_detail::format_adapter *>{&items...};
std::vector<llvm::support::detail::format_adapter *>
operator()(Ts &... items) {
return std::vector<llvm::support::detail::format_adapter *>{&items...};
}
};

llvm::StringRef fmt;
const FmtContext *context;
std::vector<llvm_support_detail::format_adapter *> adapters;
std::vector<llvm::support::detail::format_adapter *> adapters;
std::vector<FmtReplacement> replacements;

public:
Expand Down Expand Up @@ -259,8 +253,8 @@ template <typename Tuple> class FmtObject : public FmtObjectBase {

class FmtStrVecObject : public FmtObjectBase {
public:
using StrFormatAdapter =
decltype(llvm_support_detail::build_format_adapter(std::declval<std::string>()));
using StrFormatAdapter = decltype(
llvm::support::detail::build_format_adapter(std::declval<std::string>()));

FmtStrVecObject(llvm::StringRef fmt, const FmtContext *ctx,
llvm::ArrayRef<std::string> params);
Expand Down Expand Up @@ -318,15 +312,16 @@ class FmtStrVecObject : public FmtObjectBase {
/// 2. This utility does not support format layout because it is rarely needed
/// in C++ code generation.
template <typename... Ts>
inline auto tgfmt(llvm::StringRef fmt, const FmtContext *ctx, Ts &&...vals)
-> FmtObject<decltype(std::make_tuple(
llvm_support_detail::build_format_adapter(std::forward<Ts>(vals))...))> {
inline auto tgfmt(llvm::StringRef fmt, const FmtContext *ctx, Ts &&... vals)
-> FmtObject<
decltype(std::make_tuple(llvm::support::detail::build_format_adapter(
std::forward<Ts>(vals))...))> {
using ParamTuple = decltype(std::make_tuple(
llvm_support_detail::build_format_adapter(std::forward<Ts>(vals))...));
llvm::support::detail::build_format_adapter(std::forward<Ts>(vals))...));
return FmtObject<ParamTuple>(
fmt, ctx,
std::make_tuple(
llvm_support_detail::build_format_adapter(std::forward<Ts>(vals))...));
std::make_tuple(llvm::support::detail::build_format_adapter(
std::forward<Ts>(vals))...));
}

inline FmtStrVecObject tgfmt(llvm::StringRef fmt, const FmtContext *ctx,
Expand Down
5 changes: 3 additions & 2 deletions lib/TableGen/Format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void FmtObjectBase::format(raw_ostream &s) const {
s << repl.spec << kMarkerForNoSubst;
continue;
}
auto range = ArrayRef<llvm_support_detail::format_adapter *>(adapters);
auto range = ArrayRef<llvm::support::detail::format_adapter *>(adapters);
range = range.drop_front(repl.index);
llvm::interleaveComma(range, s,
[&](auto &x) { x->format(s, /*Options=*/""); });
Expand Down Expand Up @@ -254,7 +254,8 @@ 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_support_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)
Expand Down

0 comments on commit ca7675f

Please sign in to comment.