Preprocessor: Allocate MacroInfo objects using a BumpPtrAllocator instead using new/delete. This speeds up -Eonly on Cocoa.h using the regular lexer by 1.8% and the PTHLexer by 3%.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61042 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index 00d3d56..3fa76fa 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -95,9 +95,9 @@
// Free any macro definitions.
for (llvm::DenseMap<IdentifierInfo*, MacroInfo*>::iterator I =
Macros.begin(), E = Macros.end(); I != E; ++I) {
- // Free the macro definition.
- delete I->second;
- I->second = 0;
+ // We don't need to free the MacroInfo objects directly. These
+ // will be released when the BumpPtrAllocator 'BP' object gets
+ // destroyed.
I->first->setHasMacroDefinition(false);
}