//
//===----------------------------------------------------------------------===//
+#include "InterpStack.h"
+#include "Boolean.h"
+#include "Floating.h"
+#include "Integral.h"
#include <cassert>
#include <cstdlib>
-#include "InterpStack.h"
using namespace clang;
using namespace clang::interp;
Chunk->End -= Size;
StackSize -= Size;
}
+
+void InterpStack::dump() const {
+#ifndef NDEBUG
+ llvm::errs() << "Items: " << ItemTypes.size() << ". Size: " << size() << "\n";
+ size_t Index = 0;
+ size_t Offset = align(primSize(ItemTypes[0]));
+ for (PrimType Ty : ItemTypes) {
+ llvm::errs() << Index << "/" << Offset << ": ";
+ TYPE_SWITCH(Ty, {
+ const T &V = peek<T>(Offset);
+ llvm::errs() << V;
+ });
+ llvm::errs() << "\n";
+ Offset += align(primSize(Ty));
+ ++Index;
+ }
+#endif
+}
/// Returns whether the stack is empty.
bool empty() const { return StackSize == 0; }
+ /// dump the stack contents to stderr.
+ void dump() const;
+
private:
/// All stack slots are aligned to the native pointer alignment for storage.
/// The size of an object is rounded up to a pointer alignment multiple.