Insert fn for void functions (#596)

This commit is contained in:
Jon Meow
2021-06-24 10:16:21 -07:00
committed by GitHub
parent 2344a52e24
commit 9bdabda851
14 changed files with 50 additions and 35 deletions
+7 -2
View File
@@ -13,8 +13,13 @@ namespace Carbon {
FnInserter::FnInserter(std::map<std::string, Replacements>& in_replacements,
cam::MatchFinder* finder)
: Matcher(in_replacements) {
finder->addMatcher(cam::functionDecl(cam::hasTrailingReturn()).bind(Label),
this);
finder->addMatcher(
cam::functionDecl(cam::anyOf(cam::hasTrailingReturn(),
cam::returns(cam::asString("void"))),
cam::unless(cam::anyOf(cam::cxxConstructorDecl(),
cam::cxxDestructorDecl())))
.bind(Label),
this);
}
void FnInserter::run(const cam::MatchFinder::MatchResult& result) {