[clang] [ASTMatchers] Extend hasName matcher when matching templates (PR #100349)
Julian Schmidt via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 24 06:55:21 PDT 2024
================
@@ -638,6 +638,39 @@ bool HasNameMatcher::matchesNodeFullFast(const NamedDecl &Node) const {
return Patterns.foundMatch(/*AllowFullyQualified=*/true);
}
+static std::optional<StringRef> consumePatternBack(StringRef Pattern,
+ StringRef Target) {
+ while (!Pattern.empty()) {
+ auto Index = Pattern.rfind("<*>");
+ if (Index == StringRef::npos) {
+ if (Target.consume_back(Pattern))
+ return Target;
+ return {};
+ }
+ auto Suffix = Pattern.substr(Index + 2);
+ if (!Target.consume_back(Suffix))
+ return {};
+ auto BracketCount = 1;
----------------
5chmidti wrote:
You're using `auto` three times here without the type mentioned on the RHS (not sure how strict `clang/` is w.r.t. this)
`Suffix` and `Index` can be `const`
https://github.com/llvm/llvm-project/pull/100349
More information about the cfe-commits
mailing list