[clang] [clang][dataflow] Use smart pointer caching in unchecked optional accessor (PR #120249)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 23 02:36:20 PST 2024
================
@@ -71,10 +73,28 @@ template <typename Base> class CachedConstAccessorsLattice : public Base {
/// Requirements:
///
/// - `CE` should return a location (GLValue or a record type).
+ ///
+ /// DEPRECATED: switch users to the below overload which takes Callee and Type
+ /// directly.
StorageLocation *getOrCreateConstMethodReturnStorageLocation(
const RecordStorageLocation &RecordLoc, const CallExpr *CE,
Environment &Env, llvm::function_ref<void(StorageLocation &)> Initialize);
+ /// Creates or returns a previously created `StorageLocation` associated with
+ /// a const method call `obj.getFoo()` where `RecordLoc` is the
+ /// `RecordStorageLocation` of `obj`, `Callee` is the decl for `getFoo`,
+ /// and `Type` is the return type of `getFoo`.
+ ///
+ /// The callback `Initialize` runs on the storage location if newly created.
+ ///
+ /// Requirements:
+ ///
+ /// - `Type` should return a location (GLValue or a record type).
+ StorageLocation &getOrCreateConstMethodReturnStorageLocation(
----------------
Xazax-hun wrote:
What is the reason you need to pass in the return type? Couldn't we just query it from the `FunctionDecl`?
https://github.com/llvm/llvm-project/pull/120249
More information about the cfe-commits
mailing list