summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/MacroArgs.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-15 01:51:03 +0000
committerChris Lattner <sabre@nondot.org>2009-12-15 01:51:03 +0000
commitd19564b1095859e98b469af1c0c3c9a87adb80e3 (patch)
tree0a0f03e98df8543dcad3db2601b81f679eae9279 /clang/lib/Lex/MacroArgs.cpp
parent45430bbfaa39b1bba85dac8fd607d43c6caca116 (diff)
downloadbcm5719-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/MacroArgs.cpp')
-rw-r--r--clang/lib/Lex/MacroArgs.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Lex/MacroArgs.cpp b/clang/lib/Lex/MacroArgs.cpp
index a621854814f..376cce8eb32 100644
--- a/clang/lib/Lex/MacroArgs.cpp
+++ b/clang/lib/Lex/MacroArgs.cpp
@@ -48,6 +48,19 @@ void MacroArgs::destroy(Preprocessor &PP) {
free(this);
}
+/// deallocate - This should only be called by the Preprocessor when managing
+/// its freelist.
+MacroArgs *MacroArgs::deallocate() {
+ MacroArgs *Next = ArgCache;
+
+ // Run the dtor to deallocate the vectors.
+ this->~MacroArgs();
+ // Release the memory for the object.
+ free(this);
+
+ return Next;
+}
+
/// getArgLength - Given a pointer to an expanded or unexpanded argument,
/// return the number of tokens, not counting the EOF, that make up the
OpenPOWER on IntegriCloud