================
@@ -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))
----------------
5chmidti wrote:

Because I had to check this, could you please add a comment why only `+ 2` is 
used?
Something like:

> We consume pattern suffix that includes only the `>` of our `<*>`, and drop 
> every character from the back until we encounter the corresponding `<` 
> character to ensure balanced angle brackets.


https://github.com/llvm/llvm-project/pull/100349
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to