[clang][Interp][NFC] InterpFrame::getLocal() can be const
authorTimm Bäder <tbaeder@redhat.com>
Sat, 10 Sep 2022 10:51:50 +0000 (12:51 +0200)
committerTimm Bäder <tbaeder@redhat.com>
Tue, 13 Sep 2022 08:41:24 +0000 (10:41 +0200)
Make localRef() const and use that.

clang/lib/AST/Interp/InterpFrame.h

index ca9803d..88b4a5a 100644 (file)
@@ -63,7 +63,7 @@ public:
   size_t getFrameOffset() const { return FrameOffset; }
 
   /// Returns the value of a local variable.
-  template <typename T> const T &getLocal(unsigned Offset) {
+  template <typename T> const T &getLocal(unsigned Offset) const {
     return localRef<T>(Offset);
   }
 
@@ -118,7 +118,7 @@ private:
   }
 
   /// Returns an offset to a local.
-  template <typename T> T &localRef(unsigned Offset) {
+  template <typename T> T &localRef(unsigned Offset) const {
     return *reinterpret_cast<T *>(Locals.get() + Offset);
   }