From 0c8cd1ac55720276ad41fa7b4f8785bead5afd32 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Wed, 27 Jul 2011 18:41:12 +0000 Subject: [PATCH] Change ASTContext::getSideTableAllocatedMemory() to use llvm::capacity_in_bytes(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136235 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ASTContext.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 5463b7b7b0..c8ba1f1107 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -30,6 +30,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Capacity.h" #include "CXXABI.h" #include @@ -6473,16 +6474,17 @@ MangleContext *ASTContext::createMangleContext() { CXXABI::~CXXABI() {} size_t ASTContext::getSideTableAllocatedMemory() const { - size_t bytes = 0; - bytes += ASTRecordLayouts.getMemorySize(); - bytes += ObjCLayouts.getMemorySize(); - bytes += KeyFunctions.getMemorySize(); - bytes += ObjCImpls.getMemorySize(); - bytes += BlockVarCopyInits.getMemorySize(); - bytes += DeclAttrs.getMemorySize(); - bytes += InstantiatedFromStaticDataMember.getMemorySize(); - bytes += InstantiatedFromUsingDecl.getMemorySize(); - bytes += InstantiatedFromUsingShadowDecl.getMemorySize(); - bytes += InstantiatedFromUnnamedFieldDecl.getMemorySize(); - return bytes; + return ASTRecordLayouts.getMemorySize() + + llvm::capacity_in_bytes(ObjCLayouts) + + llvm::capacity_in_bytes(KeyFunctions) + + llvm::capacity_in_bytes(ObjCImpls) + + llvm::capacity_in_bytes(BlockVarCopyInits) + + llvm::capacity_in_bytes(DeclAttrs) + + llvm::capacity_in_bytes(InstantiatedFromStaticDataMember) + + llvm::capacity_in_bytes(InstantiatedFromUsingDecl) + + llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) + + llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) + + llvm::capacity_in_bytes(OverriddenMethods) + + llvm::capacity_in_bytes(Types) + + llvm::capacity_in_bytes(VariableArrayTypes); } -- 2.40.0