diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-15 01:51:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-15 01:51:03 +0000 |
commit | d19564b1095859e98b469af1c0c3c9a87adb80e3 (patch) | |
tree | 0a0f03e98df8543dcad3db2601b81f679eae9279 /clang/lib/Lex/Preprocessor.cpp | |
parent | 45430bbfaa39b1bba85dac8fd607d43c6caca116 (diff) | |
download | bcm5719-llvm-d19564b1095859e98b469af1c0c3c9a87adb80e3.tar.gz bcm5719-llvm-d19564b1095859e98b469af1c0c3c9a87adb80e3.zip |
set up the machinery for a MacroArgs cache hanging off Preprocessor.
We creating and free thousands of MacroArgs objects (and the related
std::vectors hanging off them) for the testcase in PR5610 even though
there are only ~20 live at a time. This doesn't actually use the
cache yet.
llvm-svn: 91391
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 4ab0d3063c4..d4e441b2f18 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -26,6 +26,7 @@ //===----------------------------------------------------------------------===// #include "clang/Lex/Preprocessor.h" +#include "MacroArgs.h" #include "clang/Lex/HeaderSearch.h" #include "clang/Lex/MacroInfo.h" #include "clang/Lex/Pragma.h" @@ -51,7 +52,7 @@ Preprocessor::Preprocessor(Diagnostic &diags, const LangOptions &opts, : Diags(&diags), Features(opts), Target(target),FileMgr(Headers.getFileMgr()), SourceMgr(SM), HeaderInfo(Headers), Identifiers(opts, IILookup), BuiltinInfo(Target), CodeCompletionFile(0), CurPPLexer(0), CurDirLookup(0), - Callbacks(0) { + Callbacks(0), MacroArgCache(0) { ScratchBuf = new ScratchBuffer(SourceMgr); CounterValue = 0; // __COUNTER__ starts at 0. OwnsHeaderSearch = OwnsHeaders; @@ -111,6 +112,10 @@ Preprocessor::~Preprocessor() { // Free any cached macro expanders. for (unsigned i = 0, e = NumCachedTokenLexers; i != e; ++i) delete TokenLexerCache[i]; + + // Free any cached MacroArgs. + for (MacroArgs *ArgList = MacroArgCache; ArgList; ) + ArgList = ArgList->deallocate(); // Release pragma information. delete PragmaHandlers; |