From e6a7dabdefd328729bdcf15a434108b4c0bc64fb Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 19 Oct 2010 17:40:53 +0000 Subject: In ~Preprocessor(), also cleanup the MacroInfo objects left-over from stray "#pragma push_macro" uses. This fixes a potential memory leak. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116826 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/Preprocessor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/Lex/Preprocessor.cpp') diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 5160acf19e..56ed765924 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -123,6 +123,13 @@ Preprocessor::~Preprocessor() { // memory alocated by MacroInfo. (*I)->Destroy(); } + for (llvm::DenseMap >::iterator I = + PragmaPushMacroInfo.begin(), E = PragmaPushMacroInfo.end(); I!=E; ++I){ + for (std::vector::iterator I2 = I->second.begin(), E2 = I->second.end(); + I2 != E2; ++I2) { + (*I2)->Destroy(); + } + } // Free any cached macro expanders. for (unsigned i = 0, e = NumCachedTokenLexers; i != e; ++i) -- cgit v1.2.3-18-g5258