Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LLVM namespace #89

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions include/llvm-dialects/TableGen/Format.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment on lines +40 to +42
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the file uses spaces, not tabs, so this should too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I will fix this.

#endif

/// Format context containing substitutions for special placeholders.
///
/// This context divides special placeholders into two categories: builtin ones
Expand Down Expand Up @@ -185,14 +192,14 @@ class FmtObjectBase {
// std::vector<Base*>.
struct CreateAdapters {
template <typename... Ts>
std::vector<llvm::detail::format_adapter *> operator()(Ts &...items) {
return std::vector<llvm::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::detail::format_adapter *> adapters;
std::vector<llvm_support_detail::format_adapter *> adapters;
std::vector<FmtReplacement> replacements;

public:
Expand Down Expand Up @@ -253,7 +260,7 @@ template <typename Tuple> class FmtObject : public FmtObjectBase {
class FmtStrVecObject : public FmtObjectBase {
public:
using StrFormatAdapter =
decltype(llvm::detail::build_format_adapter(std::declval<std::string>()));
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 @@ -313,13 +320,13 @@ class FmtStrVecObject : public FmtObjectBase {
template <typename... Ts>
inline auto tgfmt(llvm::StringRef fmt, const FmtContext *ctx, Ts &&...vals)
-> FmtObject<decltype(std::make_tuple(
llvm::detail::build_format_adapter(std::forward<Ts>(vals))...))> {
llvm_support_detail::build_format_adapter(std::forward<Ts>(vals))...))> {
using ParamTuple = decltype(std::make_tuple(
llvm::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::detail::build_format_adapter(std::forward<Ts>(vals))...));
llvm_support_detail::build_format_adapter(std::forward<Ts>(vals))...));
}

inline FmtStrVecObject tgfmt(llvm::StringRef fmt, const FmtContext *ctx,
Expand Down
4 changes: 2 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::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,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)
Expand Down
Loading