mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 13:51:05 +01:00
Refactor Matcher code to reduce per-Matcher boilerplate (#615)
This is in part to eliminate the "sm" and "lang_opts" variables that received comment, but also cuts back on the use of auto.
This commit is contained in:
@@ -12,13 +12,16 @@ namespace Carbon {
|
||||
// Updates variable declarations for `var name: Type`.
|
||||
class VarDecl : public Matcher {
|
||||
public:
|
||||
explicit VarDecl(std::map<std::string, Replacements>& in_replacements,
|
||||
MatchFinder* finder);
|
||||
|
||||
void run(const MatchFinder::MatchResult& result) override;
|
||||
using Matcher::Matcher;
|
||||
void Run() override;
|
||||
|
||||
private:
|
||||
static constexpr char Label[] = "VarDecl";
|
||||
auto GetTypeStr(const clang::VarDecl& decl) -> std::string;
|
||||
};
|
||||
|
||||
class VarDeclFactory : public MatcherFactoryBase<VarDecl> {
|
||||
public:
|
||||
auto GetAstMatcher() -> clang::ast_matchers::DeclarationMatcher override;
|
||||
};
|
||||
|
||||
} // namespace Carbon
|
||||
|
||||
Reference in New Issue
Block a user