================
@@ -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(
----------------
jvoung wrote:

Good point! Maybe I was looking at how the old CallExpr version, which used the 
type from CE->getType() and thought I needed to pass the type in separately 
(since the CE isn't visible anymore). 

But getting the type from the `FunctionDecl` I think makes sense, especially 
w.r.t. the `assert(Type->isReferenceType() || Type->isRecordType());`. 
`CE->getType()` seems to have the reference part excluded (and instead 
indicated by CE->isGLValue), so wouldn't have been able to determine 
isReferenceType.

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

Reply via email to