diff options
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index fdc18f8..e7aa286 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -118,6 +118,8 @@ Preprocessor::Preprocessor(Diagnostic &diags, const LangOptions &opts, Preprocessor::~Preprocessor() { assert(BacktrackPositions.empty() && "EnableBacktrack/Backtrack imbalance!"); + assert(MacroExpandingLexersStack.empty() && MacroExpandedTokens.empty() && + "Preprocessor::HandleEndOfTokenLexer should have cleared those"); while (!IncludeMacroStack.empty()) { delete IncludeMacroStack.back().TheLexer; @@ -225,6 +227,10 @@ Preprocessor::macro_begin(bool IncludeExternalMacros) const { return Macros.begin(); } +size_t Preprocessor::getTotalMemory() const { + return BP.getTotalMemory() + MacroExpandedTokens.capacity()*sizeof(Token); +} + Preprocessor::macro_iterator Preprocessor::macro_end(bool IncludeExternalMacros) const { if (IncludeExternalMacros && ExternalSource && @@ -322,15 +328,15 @@ llvm::StringRef Preprocessor::getSpelling(const Token &Tok, /// location for it. If specified, the source location provides a source /// location for the token. void Preprocessor::CreateString(const char *Buf, unsigned Len, Token &Tok, - SourceLocation InstantiationLoc) { + SourceLocation ExpansionLoc) { Tok.setLength(Len); const char *DestPtr; SourceLocation Loc = ScratchBuf->getToken(Buf, Len, DestPtr); - if (InstantiationLoc.isValid()) - Loc = SourceMgr.createInstantiationLoc(Loc, InstantiationLoc, - InstantiationLoc, Len); + if (ExpansionLoc.isValid()) + Loc = SourceMgr.createInstantiationLoc(Loc, ExpansionLoc, + ExpansionLoc, Len); Tok.setLocation(Loc); // If this is a raw identifier or a literal token, set the pointer data. @@ -528,10 +534,10 @@ CommentHandler::~CommentHandler() { } CodeCompletionHandler::~CodeCompletionHandler() { } void Preprocessor::createPreprocessingRecord( - bool IncludeNestedMacroInstantiations) { + bool IncludeNestedMacroExpansions) { if (Record) return; - Record = new PreprocessingRecord(IncludeNestedMacroInstantiations); + Record = new PreprocessingRecord(IncludeNestedMacroExpansions); addPPCallbacks(Record); } |