[clang] e9eb836 - [clang][Interp][NFC] Add an assertion

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 26 02:54:07 PDT 2023


Author: Timm Bäder
Date: 2023-07-26T11:50:07+02:00
New Revision: e9eb8362f0a580ba8a4cb173b6e8414a6d1a4db4

URL: https://github.com/llvm/llvm-project/commit/e9eb8362f0a580ba8a4cb173b6e8414a6d1a4db4
DIFF: https://github.com/llvm/llvm-project/commit/e9eb8362f0a580ba8a4cb173b6e8414a6d1a4db4.diff

LOG: [clang][Interp][NFC] Add an assertion

Added: 
    

Modified: 
    clang/lib/AST/Interp/InterpBuiltin.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/InterpBuiltin.cpp b/clang/lib/AST/Interp/InterpBuiltin.cpp
index e161a0681dcfa4..b29747221ab552 100644
--- a/clang/lib/AST/Interp/InterpBuiltin.cpp
+++ b/clang/lib/AST/Interp/InterpBuiltin.cpp
@@ -15,6 +15,7 @@ namespace interp {
 
 template <typename T>
 static T getParam(const InterpFrame *Frame, unsigned Index) {
+  assert(Frame->getFunction()->getNumParams() > Index);
   unsigned Offset = Frame->getFunction()->getParamOffset(Index);
   return Frame->getParam<T>(Offset);
 }


        


More information about the cfe-commits mailing list