[clang] [clang][dataflow] Use smart pointer caching in unchecked optional accessor (PR #120249)
Yitzhak Mandelbaum via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 6 12:46:05 PST 2025
================
@@ -58,6 +63,106 @@ ast_matchers::StatementMatcher isSmartPointerLikeOperatorArrow();
ast_matchers::StatementMatcher isSmartPointerLikeValueMethodCall();
ast_matchers::StatementMatcher isSmartPointerLikeGetMethodCall();
+// Common transfer functions.
+
+/// Returns the "canonical" callee for smart pointer operators (`*` and `->`)
+/// as a key for caching.
+///
+/// We choose `*` as the canonical one, since it needs a
+/// StorageLocation anyway.
+///
+/// Note: there may be multiple `operator*` (one const, one non-const).
+/// We pick the const one, which the above provided matchers require to exist.
+const FunctionDecl *
+getCanonicalSmartPointerLikeOperatorCallee(const CallExpr *CE);
+
+/// A transfer function for `operator*` (and `value`) calls
+/// that can be cached.
----------------
ymand wrote:
Maybe explain `InitializeLoc` argument?
https://github.com/llvm/llvm-project/pull/120249
More information about the cfe-commits
mailing list