aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/MacroArgs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Lex/MacroArgs.cpp')
-rw-r--r--lib/Lex/MacroArgs.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/Lex/MacroArgs.cpp b/lib/Lex/MacroArgs.cpp
index c14d7c438d60..376cce8eb321 100644
--- a/lib/Lex/MacroArgs.cpp
+++ b/lib/Lex/MacroArgs.cpp
@@ -20,7 +20,8 @@ using namespace clang;
/// MacroArgs ctor function - This destroys the vector passed in.
MacroArgs *MacroArgs::create(const MacroInfo *MI,
const Token *UnexpArgTokens,
- unsigned NumToks, bool VarargsElided) {
+ unsigned NumToks, bool VarargsElided,
+ Preprocessor &PP) {
assert(MI->isFunctionLike() &&
"Can't have args for an object-like macro!");
@@ -40,13 +41,26 @@ MacroArgs *MacroArgs::create(const MacroInfo *MI,
/// destroy - Destroy and deallocate the memory for this object.
///
-void MacroArgs::destroy() {
+void MacroArgs::destroy(Preprocessor &PP) {
// Run the dtor to deallocate the vectors.
this->~MacroArgs();
// Release the memory for the object.
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