[clang] 9642343 - [clang][Interp][NFC] Make a local variable const

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 6 05:52:31 PDT 2023


Author: Timm Bäder
Date: 2023-07-06T14:52:05+02:00
New Revision: 9642343d3023bdf5edcb2a016a9a9cc6cfd23834

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

LOG: [clang][Interp][NFC] Make a local variable const

And add some assertions.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/InterpState.cpp b/clang/lib/AST/Interp/InterpState.cpp
index bd7daf38796ca6..abc29e059aa9f0 100644
--- a/clang/lib/AST/Interp/InterpState.cpp
+++ b/clang/lib/AST/Interp/InterpState.cpp
@@ -46,7 +46,10 @@ bool InterpState::reportOverflow(const Expr *E, const llvm::APSInt &Value) {
 }
 
 void InterpState::deallocate(Block *B) {
-  Descriptor *Desc = B->getDescriptor();
+  assert(B);
+  const Descriptor *Desc = B->getDescriptor();
+  assert(Desc);
+
   if (B->hasPointers()) {
     size_t Size = B->getSize();
 


        


More information about the cfe-commits mailing list