]> granicus.if.org Git - clang/commitdiff
[AST] Add individual size info for Types in -print-stats
authorBruno Ricci <riccibrun@gmail.com>
Mon, 6 Aug 2018 15:17:32 +0000 (15:17 +0000)
committerBruno Ricci <riccibrun@gmail.com>
Mon, 6 Aug 2018 15:17:32 +0000 (15:17 +0000)
This mirrors what is done for Decls and Stmts in the -print-stats
output, ie instead of printing "57426 LValueReference types"
we print "57426 LValueReference types, 40 each (2297040 bytes)".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339024 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp

index ad635d7c8b0aa4e755c478b5036b843264e5e9df..8f7424208fd729fcc55faae519839ffd46e6a847 100644 (file)
@@ -885,7 +885,9 @@ void ASTContext::PrintStats() const {
 #define TYPE(Name, Parent)                                              \
   if (counts[Idx])                                                      \
     llvm::errs() << "    " << counts[Idx] << " " << #Name               \
-                 << " types\n";                                         \
+                 << " types, " << sizeof(Name##Type) << " each "        \
+                 << "(" << counts[Idx] * sizeof(Name##Type)             \
+                 << " bytes)\n";                                        \
   TotalBytes += counts[Idx] * sizeof(Name##Type);                       \
   ++Idx;
 #define ABSTRACT_TYPE(Name, Parent)