summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-12-15 19:56:42 +0000
committerTed Kremenek <kremenek@apple.com>2008-12-15 19:56:42 +0000
commit6c7ea11300958d09908dc5b9aca6bd58acffef58 (patch)
treedf8fd9e4f36a9898d16c9c90b75c107e68b658f5 /clang/lib/Lex/Preprocessor.cpp
parent3cdf0a8a2e0e146c5cc8f5bcc5ef4e473d145b60 (diff)
downloadbcm5719-llvm-6c7ea11300958d09908dc5b9aca6bd58acffef58.tar.gz
bcm5719-llvm-6c7ea11300958d09908dc5b9aca6bd58acffef58.zip
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%.
llvm-svn: 61042
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 00d3d56e2e8..3fa76fa1615 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -95,9 +95,9 @@ Preprocessor::~Preprocessor() {
// 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);
}
OpenPOWER on IntegriCloud