[clang][Interp][NFC] InterpFrame::getParam can be const
authorTimm Bäder <tbaeder@redhat.com>
Sat, 10 Sep 2022 10:55:41 +0000 (12:55 +0200)
committerTimm Bäder <tbaeder@redhat.com>
Tue, 13 Sep 2022 08:41:28 +0000 (10:41 +0200)
Make stackRef() const as well and use that.

clang/lib/AST/Interp/InterpFrame.h

index 88b4a5a..16d073c 100644 (file)
@@ -76,7 +76,7 @@ public:
   Pointer getLocalPointer(unsigned Offset);
 
   /// Returns the value of an argument.
-  template <typename T> const T &getParam(unsigned Offset) {
+  template <typename T> const T &getParam(unsigned Offset) const {
     auto Pt = Params.find(Offset);
     if (Pt == Params.end()) {
       return stackRef<T>(Offset);
@@ -112,7 +112,7 @@ public:
 
 private:
   /// Returns an original argument from the stack.
-  template <typename T> const T &stackRef(unsigned Offset) {
+  template <typename T> const T &stackRef(unsigned Offset) const {
     assert(Args);
     return *reinterpret_cast<const T *>(Args - ArgSize + Offset);
   }