[clang] [nfc][analyzer] Add MemSpace trait to program state (PR #123003)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 27 13:01:59 PST 2025


================
@@ -119,7 +120,26 @@ class MemRegion : public llvm::FoldingSetNode {
 
   virtual MemRegionManager &getMemRegionManager() const = 0;
 
-  LLVM_ATTRIBUTE_RETURNS_NONNULL const MemSpaceRegion *getMemorySpace() const;
+  /// Deprecated. Gets the 'raw' memory space of a memory region's base region.
+  /// Deprecated in favor of the memory space trait which maps memory regions to
+  /// memory spaces, allowing dynamic updating of a memory region's memory
+  /// space.
+  /// @deprecated Use getMemorySpace(ProgramStateRef) instead.
----------------
steakhal wrote:

In your place I' comment out (aka. Remove the overload bot taking a State).
Then try to fix all the build errors.
Once all the ones are fixed that deserves to be fixed, reenable the overload to make the build errors go away.
This is important to minimize the old users.

I definitely think you shouldnt add deprecation attribute to the api that shouls be avoided. A comment or a slightly more mouthful spelling of the api shouls be enough to deliver the intent.

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


More information about the cfe-commits mailing list