[llvm-branch-commits] [clang] [analyzer][NFC] Migrate nonloc::ConcreteInt to use APSIntPtr (2/4) (PR #120436)

Gábor Horváth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 18 09:05:26 PST 2024


================
@@ -298,9 +299,12 @@ class SymbolVal : public NonLoc {
 /// Value representing integer constant.
 class ConcreteInt : public NonLoc {
 public:
-  explicit ConcreteInt(const llvm::APSInt &V) : NonLoc(ConcreteIntKind, &V) {}
+  explicit ConcreteInt(APSIntPtr V) : NonLoc(ConcreteIntKind, V.get()) {}
 
-  const llvm::APSInt &getValue() const { return *castDataAs<llvm::APSInt>(); }
+  APSIntPtr getValue() const {
+    // This is safe because in the ctor we take a safe APSIntPtr.
+    return APSIntPtr::unsafeConstructor(castDataAs<llvm::APSInt>());
----------------
Xazax-hun wrote:

> Currently the infrastructure is set up for holding raw-pointers.

Could you elaborate on what preventing us from changing this?

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


More information about the llvm-branch-commits mailing list