================
@@ -165,79 +166,70 @@ class BasicValueFactory {
 
   /// Convert - Create a new persistent APSInt with the same value as 'From'
   ///  but with the bitwidth and signedness of 'To'.
-  const llvm::APSInt &Convert(const llvm::APSInt& To,
-                              const llvm::APSInt& From) {
+  APSIntPtr Convert(const llvm::APSInt &To, const llvm::APSInt &From) {
     APSIntType TargetType(To);
     if (TargetType == APSIntType(From))
-      return From;
+      return APSIntPtr(&From);
----------------
necto wrote:

This might create a tricky bug, given that despite the doc comment and the type 
signature, this function does not create a persistent APSInt *only in this 
case*, if `From` was not persistent on the call.
I suggest requiring the `From` argument to be `APSIntPtr` to make this function 
safer.

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

Reply via email to