diff options
author | Eli Bendersky <eliben@google.com> | 2012-12-08 00:07:24 +0000 |
---|---|---|
committer | Eli Bendersky <eliben@google.com> | 2012-12-08 00:07:24 +0000 |
commit | 0ee69cc6d4fc547671303afbd715cb990e5c3af6 (patch) | |
tree | 92f3c6057d435ff61f40f7bbc676af802521fa24 /lib/AST/RecordLayoutBuilder.cpp | |
parent | 785b778203a474c6e4b9e17ae91cd2a358868877 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169654 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/RecordLayoutBuilder.cpp')
-rw-r--r-- | lib/AST/RecordLayoutBuilder.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/AST/RecordLayoutBuilder.cpp b/lib/AST/RecordLayoutBuilder.cpp index 5fbb8fa842..7f84c56d52 100644 --- a/lib/AST/RecordLayoutBuilder.cpp +++ b/lib/AST/RecordLayoutBuilder.cpp @@ -2577,6 +2577,11 @@ static void PrintOffset(raw_ostream &OS, 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 @@ static void DumpCXXRecordLayout(raw_ostream &OS, /*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'; } |