[clang] 91cab53 - [clang][Interp][NFC] Fix InterpStack::dump() for empty stacks

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 23 01:42:43 PDT 2023


Author: Timm Bäder
Date: 2023-07-23T10:31:22+02:00
New Revision: 91cab53f881086c45b44541eec8e408e3a7446b4

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

LOG: [clang][Interp][NFC] Fix InterpStack::dump() for empty stacks

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/InterpStack.cpp b/clang/lib/AST/Interp/InterpStack.cpp
index 5ca530409c8bf9..da4b36f8c1bf35 100644
--- a/clang/lib/AST/Interp/InterpStack.cpp
+++ b/clang/lib/AST/Interp/InterpStack.cpp
@@ -86,6 +86,9 @@ void InterpStack::shrink(size_t Size) {
 void InterpStack::dump() const {
 #ifndef NDEBUG
   llvm::errs() << "Items: " << ItemTypes.size() << ". Size: " << size() << "\n";
+  if (ItemTypes.empty())
+    return;
+
   size_t Index = 0;
   size_t Offset = align(primSize(ItemTypes[0]));
   for (PrimType Ty : ItemTypes) {


        


More information about the cfe-commits mailing list