================ @@ -653,10 +686,12 @@ bool HasNameMatcher::matchesNodeFullSlow(const NamedDecl &Node) const { for (const StringRef Pattern : Names) { if (Pattern.starts_with("::")) { - if (FullName == Pattern) + if (auto Result = consumePatternBack(Pattern, FullName); + Result && Result->empty()) { return true; - } else if (FullName.ends_with(Pattern) && - FullName.drop_back(Pattern.size()).ends_with("::")) { + } + } else if (auto Result = consumePatternBack(Pattern, FullName); + Result && Result->ends_with("::")) { return true; } ---------------- 5chmidti wrote:
You could write this loop body as ```c++ const std::optional<StringRef> Result = consumePatternBack(Pattern, FullName); if (!Result) continue; if ((Pattern.starts_with("::") && Result->empty()) || Result->ends_with("::")) return true; ``` which is more readable IMO 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