================ @@ -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>()); ---------------- steakhal wrote:
Currently the infrastructure is set up for holding raw-pointers. I don't know of a better way achieving this other than boxing/unboxing like done so. I can't hold a pointer to a `APSIntPtr` object, if that's not exactly the object held by the factory. In the factory, I can't allocate this, because this is just a view (a raw-pointer) - so its conceptually different. The ergonomics would be better on one side if I had `APSIntRef` wrapping a reference, but then I'd lose copy and assign operations that come really handy in a lot of places. So these were the factors I considered when designing this type. https://github.com/llvm/llvm-project/pull/120436 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits