[clang] 5821b09 - [clang][bytecode] Print primitive arrays in Descriptor::dumpFull() (#166393)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 5 02:53:03 PST 2025
Author: Timm Baeder
Date: 2025-11-05T11:52:59+01:00
New Revision: 5821b09e5f348cb750d4b9cc2f532ca34cd8a6c6
URL: https://github.com/llvm/llvm-project/commit/5821b09e5f348cb750d4b9cc2f532ca34cd8a6c6
DIFF: https://github.com/llvm/llvm-project/commit/5821b09e5f348cb750d4b9cc2f532ca34cd8a6c6.diff
LOG: [clang][bytecode] Print primitive arrays in Descriptor::dumpFull() (#166393)
And recurse into records properly.
Added:
Modified:
clang/lib/AST/ByteCode/Disasm.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/ByteCode/Disasm.cpp b/clang/lib/AST/ByteCode/Disasm.cpp
index fd0903f2e652c..638028f84ff24 100644
--- a/clang/lib/AST/ByteCode/Disasm.cpp
+++ b/clang/lib/AST/ByteCode/Disasm.cpp
@@ -436,8 +436,28 @@ LLVM_DUMP_METHOD void Descriptor::dumpFull(unsigned Offset,
FO += ElemDesc->getAllocSize();
}
+ } else if (isPrimitiveArray()) {
+ OS.indent(Spaces) << "Elements: " << getNumElems() << '\n';
+ OS.indent(Spaces) << "Element type: " << primTypeToString(getPrimType())
+ << '\n';
+ unsigned FO = Offset + sizeof(InitMapPtr);
+ for (unsigned I = 0; I != getNumElems(); ++I) {
+ OS.indent(Spaces) << "Element " << I << " offset: " << FO << '\n';
+ FO += getElemSize();
+ }
} else if (isRecord()) {
ElemRecord->dump(OS, Indent + 1, Offset);
+ unsigned I = 0;
+ for (const Record::Field &F : ElemRecord->fields()) {
+ OS.indent(Spaces) << "- Field " << I << ": ";
+ {
+ ColorScope SC(OS, true, {llvm::raw_ostream::BRIGHT_RED, true});
+ OS << F.Decl->getName();
+ }
+ OS << ". Offset " << (Offset + F.Offset) << "\n";
+ F.Desc->dumpFull(Offset + F.Offset, Indent + 1);
+ ++I;
+ }
} else if (isPrimitive()) {
} else {
}
More information about the cfe-commits
mailing list