diff options
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 2 | ||||
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 4 | ||||
-rw-r--r-- | tools/libclang/CIndex.cpp | 3 |
3 files changed, 7 insertions, 2 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index 76e3f59ef4..abba959dee 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -770,6 +770,8 @@ public: void PrintStats(); + size_t getTotalMemory() const; + /// HandleMicrosoftCommentPaste - When the macro expander pastes together a /// comment (/##/) in microsoft mode, this method handles updating the current /// state, returning the token on the next source line. diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index fdc18f8781..48a23880f3 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -225,6 +225,10 @@ Preprocessor::macro_begin(bool IncludeExternalMacros) const { return Macros.begin(); } +size_t Preprocessor::getTotalMemory() const { + return BP.getTotalMemory(); +} + Preprocessor::macro_iterator Preprocessor::macro_end(bool IncludeExternalMacros) const { if (IncludeExternalMacros && ExternalSource && diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 49b02c4bdf..3f9d34f675 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -5400,10 +5400,9 @@ CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU) { // How much memory is being used by the Preprocessor? Preprocessor &pp = astUnit->getPreprocessor(); - const llvm::BumpPtrAllocator &ppAlloc = pp.getPreprocessorAllocator(); createCXTUResourceUsageEntry(*entries, CXTUResourceUsage_Preprocessor, - ppAlloc.getTotalMemory()); + pp.getTotalMemory()); if (PreprocessingRecord *pRec = pp.getPreprocessingRecord()) { createCXTUResourceUsageEntry(*entries, |