#ifndef LLVM_CLANG_TOOLING_TRANSFORMER_TRANSFORMER_H_
#define LLVM_CLANG_TOOLING_TRANSFORMER_TRANSFORMER_H_
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Tooling/Refactoring/AtomicChange.h"
#include "clang/Tooling/Transformer/RewriteRule.h"
#include "llvm/Support/Error.h"
#include <functional>
#include <utility>
namespace clang {
namespace tooling {
namespace detail {
class TransformerImpl { … };
template <class T> struct type_identity { … };
}
template <typename T> struct TransformerResult { … };
template <> struct TransformerResult<void> { … };
class Transformer : public ast_matchers::MatchFinder::MatchCallback { … };
namespace detail {
template <typename T>
llvm::Error
populateMetadata(const transformer::RewriteRuleWith<T> &Rule,
size_t SelectedCase,
const ast_matchers::MatchFinder::MatchResult &Match,
TransformerResult<T> &Result) { … }
template <typename T> class WithMetadataImpl final : public TransformerImpl { … };
}
template <typename MetadataT>
Transformer::Transformer(
transformer::RewriteRuleWith<MetadataT> Rule,
std::function<void(llvm::Expected<TransformerResult<
typename detail::type_identity<MetadataT>::type>>)>
Consumer)
: Impl(std::make_unique<detail::WithMetadataImpl<MetadataT>>(
std::move(Rule), std::move(Consumer))) { … }
}
}
#endif