[clang] [NFC] [dataflow] generalize smart pointer caching (PR #133350)

Jan Voung via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 28 12:07:30 PDT 2025


================
@@ -164,16 +161,19 @@ ast_matchers::StatementMatcher isPointerLikeOperatorArrow() {
                            ofClass(pointerClass()))));
 }
 
-ast_matchers::StatementMatcher isSmartPointerLikeValueMethodCall() {
+ast_matchers::StatementMatcher
+isSmartPointerLikeValueMethodCall(clang::StringRef MethodName) {
   return cxxMemberCallExpr(callee(cxxMethodDecl(
       parameterCountIs(0), returns(hasCanonicalType(referenceType())),
-      hasName("value"), ofClass(smartPointerClassWithValue()))));
+      hasName(MethodName),
----------------
jvoung wrote:

Just checking -- is the plan later to have something like anyOf(isSmartPointerLikeValueMethodCall(Name1),
 isSmartPointerLikeValueMethodCall(Name2)), etc. ?

Or at some point add a matcher isSmartPointerLikeValueMethodCallAnyOf(Name1, Name2)... using hasAnyName() ?

https://github.com/llvm/llvm-project/pull/133350


More information about the cfe-commits mailing list