[cfe-commits] r169654 - /cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
Eli Bendersky
eliben at google.com
Fri Dec 7 16:07:24 PST 2012
Author: eliben
Date: Fri Dec 7 18:07:24 2012
New Revision: 169654
URL: http://llvm.org/viewvc/llvm-project?rev=169654&view=rev
Log:
Currently when AST record layouts are dumped with -fdump-record-layouts, the
following:
sizeof=132, dsize=132, align=4
nvsize=132, nvalign=4
Is not indented, so when classes are nested there is no way to know to
which class it belongs.
Fix this problem by indenting the size summary properly for each class.
Modified:
cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=169654&r1=169653&r2=169654&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Fri Dec 7 18:07:24 2012
@@ -2577,6 +2577,11 @@
OS.indent(IndentLevel * 2);
}
+static void PrintIndentNoOffset(raw_ostream &OS, unsigned IndentLevel) {
+ OS << " | ";
+ OS.indent(IndentLevel * 2);
+}
+
static void DumpCXXRecordLayout(raw_ostream &OS,
const CXXRecordDecl *RD, const ASTContext &C,
CharUnits Offset,
@@ -2680,11 +2685,14 @@
/*IncludeVirtualBases=*/false);
}
- OS << " sizeof=" << Layout.getSize().getQuantity();
+ PrintIndentNoOffset(OS, IndentLevel - 1);
+ OS << "[sizeof=" << Layout.getSize().getQuantity();
OS << ", dsize=" << Layout.getDataSize().getQuantity();
OS << ", align=" << Layout.getAlignment().getQuantity() << '\n';
- OS << " nvsize=" << Layout.getNonVirtualSize().getQuantity();
- OS << ", nvalign=" << Layout.getNonVirtualAlign().getQuantity() << '\n';
+
+ PrintIndentNoOffset(OS, IndentLevel - 1);
+ OS << " nvsize=" << Layout.getNonVirtualSize().getQuantity();
+ OS << ", nvalign=" << Layout.getNonVirtualAlign().getQuantity() << "]\n";
OS << '\n';
}
More information about the cfe-commits
mailing list