From: Ted Kremenek Date: Thu, 17 Apr 2008 22:31:54 +0000 (+0000) Subject: class Preprocessor: Now owns the "predefines" char*; it deletes [] it in its dstor. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=339b9c27759d7b6a53e2370f83f66e78b3254595;p=clang class Preprocessor: Now owns the "predefines" char*; it deletes [] it in its dstor. clang.cpp: InitializePreprocessor now makes a copy of the contents of PredefinesBuffer and passes it to the preprocessor object. clang.cpp: DriverPreprocessorFactory now calls "InitializePreprocessor" instead of this being done in main(). html::HighlightMacros() now takes a PreprocessorFactory, allowing it to conjure up a new Preprocessor to highlight macros. class HTMLDiagnostics now takes a PreprocessorFactory* that it can use for html::HighlightMacros(). Updated clients of HTMLDiagnostics to use this new interface. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49875 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp index e6e8f45eb6..9653526afb 100644 --- a/Driver/ASTConsumers.cpp +++ b/Driver/ASTConsumers.cpp @@ -649,17 +649,18 @@ protected: Diagnostic &Diags; ASTContext* Ctx; Preprocessor* PP; + PreprocessorFactory* PPF; const std::string& HTMLDir; bool Visualize; bool TrimGraph; llvm::OwningPtr PD; bool AnalyzeAll; public: - CheckerConsumer(Diagnostic &diags, Preprocessor* pp, + CheckerConsumer(Diagnostic &diags, Preprocessor* pp, PreprocessorFactory* ppf, const std::string& fname, const std::string& htmldir, bool visualize, bool trim, bool analyzeAll) - : CFGVisitor(fname), Diags(diags), PP(pp), HTMLDir(htmldir), + : CFGVisitor(fname), Diags(diags), PP(pp), PPF(ppf), HTMLDir(htmldir), Visualize(visualize), TrimGraph(trim), AnalyzeAll(analyzeAll) {} virtual void Initialize(ASTContext &Context) { Ctx = &Context; } @@ -687,7 +688,7 @@ void CheckerConsumer::VisitCFG(CFG& C, Decl& CD) { // Lazily create the diagnostic client. if (!HTMLDir.empty() && PD.get() == NULL) - PD.reset(CreateHTMLDiagnosticClient(HTMLDir, PP)); + PD.reset(CreateHTMLDiagnosticClient(HTMLDir, PP, PPF)); if (!Visualize) { @@ -734,9 +735,11 @@ namespace { class GRSimpleValsVisitor : public CheckerConsumer { public: GRSimpleValsVisitor(Diagnostic &diags, Preprocessor* pp, + PreprocessorFactory* ppf, const std::string& fname, const std::string& htmldir, bool visualize, bool trim, bool analyzeAll) - : CheckerConsumer(diags, pp, fname, htmldir, visualize, trim, analyzeAll) {} + : CheckerConsumer(diags, pp, ppf, fname, htmldir, visualize, + trim, analyzeAll) {} virtual const char* getCheckerName() { return "GRSimpleVals"; } @@ -748,12 +751,13 @@ public: ASTConsumer* clang::CreateGRSimpleVals(Diagnostic &Diags, Preprocessor* PP, + PreprocessorFactory* PPF, const std::string& FunctionName, const std::string& HTMLDir, bool Visualize, bool TrimGraph, bool AnalyzeAll) { - return new GRSimpleValsVisitor(Diags, PP, FunctionName, HTMLDir, + return new GRSimpleValsVisitor(Diags, PP, PPF, FunctionName, HTMLDir, Visualize, TrimGraph, AnalyzeAll); } @@ -765,10 +769,12 @@ namespace { class CFRefCountCheckerVisitor : public CheckerConsumer { public: CFRefCountCheckerVisitor(Diagnostic &diags, Preprocessor* pp, + PreprocessorFactory* ppf, const std::string& fname, const std::string& htmldir, bool visualize, bool trim, bool analyzeAll) - : CheckerConsumer(diags, pp, fname, htmldir, visualize, trim, analyzeAll) {} + : CheckerConsumer(diags, pp, ppf, fname, htmldir, visualize, + trim, analyzeAll) {} virtual const char* getCheckerName() { return "CFRefCountChecker"; } @@ -780,12 +786,13 @@ public: ASTConsumer* clang::CreateCFRefChecker(Diagnostic &Diags, Preprocessor* PP, + PreprocessorFactory* PPF, const std::string& FunctionName, const std::string& HTMLDir, bool Visualize, bool TrimGraph, bool AnalyzeAll) { - return new CFRefCountCheckerVisitor(Diags, PP, FunctionName, HTMLDir, + return new CFRefCountCheckerVisitor(Diags, PP, PPF, FunctionName, HTMLDir, Visualize, TrimGraph, AnalyzeAll); } diff --git a/Driver/ASTConsumers.h b/Driver/ASTConsumers.h index 391ff02227..7ef42a0707 100644 --- a/Driver/ASTConsumers.h +++ b/Driver/ASTConsumers.h @@ -28,6 +28,8 @@ class Diagnostic; class FileManager; struct LangOptions; class Preprocessor; +class PreprocessorFactory; + ASTConsumer *CreateASTPrinter(std::ostream* OS = NULL); @@ -44,13 +46,13 @@ ASTConsumer *CreateDeadStoreChecker(Diagnostic &Diags); ASTConsumer *CreateUnitValsChecker(Diagnostic &Diags); ASTConsumer *CreateGRSimpleVals(Diagnostic &Diags, - Preprocessor* PP, + Preprocessor* PP, PreprocessorFactory* PPF, const std::string& Function, const std::string& HTMLDir, bool Visualize, bool TrimGraph, bool AnalyzeAll); ASTConsumer *CreateCFRefChecker(Diagnostic &Diags, - Preprocessor* PP, + Preprocessor* PP, PreprocessorFactory* PPF, const std::string& Function, const std::string& HTMLDir, bool Visualize, bool TrimGraph, bool AnalyzeAll); @@ -61,7 +63,7 @@ ASTConsumer *CreateCodeRewriterTest(const std::string& InFile, const LangOptions &LOpts); ASTConsumer* CreateHTMLPrinter(const std::string &OutFile, Diagnostic &D, - Preprocessor *PP); + Preprocessor *PP, PreprocessorFactory* PPF); ASTConsumer *CreateSerializationTest(Diagnostic &Diags, FileManager& FMgr, diff --git a/Driver/HTMLDiagnostics.cpp b/Driver/HTMLDiagnostics.cpp index 78381f9070..4d95c17b67 100644 --- a/Driver/HTMLDiagnostics.cpp +++ b/Driver/HTMLDiagnostics.cpp @@ -38,8 +38,10 @@ class VISIBILITY_HIDDEN HTMLDiagnostics : public PathDiagnosticClient { llvm::sys::Path Directory, FilePrefix; bool createdDir, noDir; Preprocessor* PP; + PreprocessorFactory* PPF; public: - HTMLDiagnostics(const std::string& prefix, Preprocessor* pp = NULL); + HTMLDiagnostics(const std::string& prefix, Preprocessor* pp, + PreprocessorFactory* ppf); virtual ~HTMLDiagnostics() {} @@ -53,18 +55,20 @@ public: } // end anonymous namespace -HTMLDiagnostics::HTMLDiagnostics(const std::string& prefix, Preprocessor* pp) +HTMLDiagnostics::HTMLDiagnostics(const std::string& prefix, Preprocessor* pp, + PreprocessorFactory* ppf) : Directory(prefix), FilePrefix(prefix), createdDir(false), noDir(false), - PP(pp) { + PP(pp), PPF(ppf) { // All html files begin with "report" FilePrefix.appendComponent("report"); } PathDiagnosticClient* -clang::CreateHTMLDiagnosticClient(const std::string& prefix, Preprocessor* PP) { +clang::CreateHTMLDiagnosticClient(const std::string& prefix, Preprocessor* PP, + PreprocessorFactory* PPF) { - return new HTMLDiagnostics(prefix, PP); + return new HTMLDiagnostics(prefix, PP, PPF); } //===----------------------------------------------------------------------===// @@ -122,10 +126,8 @@ void HTMLDiagnostics::HandlePathDiagnostic(const PathDiagnostic& D) { // We might not have a preprocessor if we come from a deserialized AST file, // for example. - if (PP) { - html::SyntaxHighlight(R, FileID, *PP); - // html::HighlightMacros(R, FileID, *PP); - } + if (PP) html::SyntaxHighlight(R, FileID, *PP); + if (PPF) html::HighlightMacros(R, FileID, *PPF); // Get the full directory name of the analyzed file. diff --git a/Driver/HTMLDiagnostics.h b/Driver/HTMLDiagnostics.h index 146c2cc438..be72c49fd2 100644 --- a/Driver/HTMLDiagnostics.h +++ b/Driver/HTMLDiagnostics.h @@ -17,11 +17,15 @@ #include namespace clang { - class PathDiagnosticClient; - class Preprocessor; + +class PathDiagnosticClient; +class Preprocessor; +class PreprocessorFactory; + - PathDiagnosticClient* CreateHTMLDiagnosticClient(const std::string& prefix, - Preprocessor* PP); +PathDiagnosticClient* CreateHTMLDiagnosticClient(const std::string& prefix, + Preprocessor* PP, + PreprocessorFactory* PPF); } #endif diff --git a/Driver/HTMLPrint.cpp b/Driver/HTMLPrint.cpp index ff04b0e609..ba9cd9e400 100644 --- a/Driver/HTMLPrint.cpp +++ b/Driver/HTMLPrint.cpp @@ -31,9 +31,11 @@ namespace { std::string OutFilename; Diagnostic &Diags; Preprocessor *PP; + PreprocessorFactory *PPF; public: - HTMLPrinter(const std::string &OutFile, Diagnostic &D, Preprocessor *pp) - : OutFilename(OutFile), Diags(D), PP(pp) {} + HTMLPrinter(const std::string &OutFile, Diagnostic &D, Preprocessor *pp, + PreprocessorFactory* ppf) + : OutFilename(OutFile), Diags(D), PP(pp), PPF(ppf) {} virtual ~HTMLPrinter(); void Initialize(ASTContext &context); @@ -41,8 +43,10 @@ namespace { } ASTConsumer* clang::CreateHTMLPrinter(const std::string &OutFile, - Diagnostic &D, Preprocessor *PP) { - return new HTMLPrinter(OutFile, D, PP); + Diagnostic &D, Preprocessor *PP, + PreprocessorFactory* PPF) { + + return new HTMLPrinter(OutFile, D, PP, PPF); } void HTMLPrinter::Initialize(ASTContext &context) { @@ -62,13 +66,10 @@ HTMLPrinter::~HTMLPrinter() { // We might not have a preprocessor if we come from a deserialized AST file, // for example. - if (PP) { - html::SyntaxHighlight(R, FileID, *PP); - html::HighlightMacros(R, FileID, *PP); - } + if (PP) html::SyntaxHighlight(R, FileID, *PP); + if (PPF) html::HighlightMacros(R, FileID, *PPF); html::EscapeText(R, FileID, false, true); - // Open the output. FILE *OutputFILE; if (OutFilename.empty() || OutFilename == "-") diff --git a/Driver/clang.cpp b/Driver/clang.cpp index cbd27259d7..1a6db481b6 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -48,6 +48,7 @@ #include "llvm/System/Path.h" #include #include +#include using namespace clang; //===----------------------------------------------------------------------===// @@ -586,26 +587,31 @@ static void AddImplicitInclude(std::vector &Buf, const std::string &File){ /// input file. If a failure happens, it returns 0. /// static unsigned InitializePreprocessor(Preprocessor &PP, + bool InitializeSourceMgr, const std::string &InFile, std::vector &PredefineBuffer) { + FileManager &FileMgr = PP.getFileManager(); // Figure out where to get and map in the main file. SourceManager &SourceMgr = PP.getSourceManager(); - if (InFile != "-") { - const FileEntry *File = FileMgr.getFile(InFile); - if (File) SourceMgr.createMainFileID(File, SourceLocation()); - if (SourceMgr.getMainFileID() == 0) { - fprintf(stderr, "Error reading '%s'!\n",InFile.c_str()); - return 0; - } - } else { - llvm::MemoryBuffer *SB = llvm::MemoryBuffer::getSTDIN(); - if (SB) SourceMgr.createMainFileIDForMemBuffer(SB); - if (SourceMgr.getMainFileID() == 0) { - fprintf(stderr, "Error reading standard input! Empty?\n"); - return 0; + + if (InitializeSourceMgr) { + if (InFile != "-") { + const FileEntry *File = FileMgr.getFile(InFile); + if (File) SourceMgr.createMainFileID(File, SourceLocation()); + if (SourceMgr.getMainFileID() == 0) { + fprintf(stderr, "Error reading '%s'!\n",InFile.c_str()); + return 0; + } + } else { + llvm::MemoryBuffer *SB = llvm::MemoryBuffer::getSTDIN(); + if (SB) SourceMgr.createMainFileIDForMemBuffer(SB); + if (SourceMgr.getMainFileID() == 0) { + fprintf(stderr, "Error reading standard input! Empty?\n"); + return 0; + } } } @@ -625,9 +631,13 @@ static unsigned InitializePreprocessor(Preprocessor &PP, for (unsigned i = 0, e = ImplicitIncludes.size(); i != e; ++i) AddImplicitInclude(PredefineBuffer, ImplicitIncludes[i]); - // Null terminate PredefinedBuffer and add it. + // Null terminate PredefinedBuffer and add it. We actually need to make a + // copy because PP will own the string. PredefineBuffer.push_back(0); - PP.setPredefines(&PredefineBuffer[0]); + + char* predefines = new char[PredefineBuffer.size()]; + std::copy(PredefineBuffer.begin(), PredefineBuffer.end(), predefines); + PP.setPredefines(predefines); // Once we've read this, we're done. return SourceMgr.getMainFileID(); @@ -1015,23 +1025,41 @@ static void InitializeIncludePaths(const char *Argv0, HeaderSearch &Headers, namespace { class VISIBILITY_HIDDEN DriverPreprocessorFactory : public PreprocessorFactory { + const std::string &InFile; Diagnostic &Diags; const LangOptions &LangInfo; TargetInfo &Target; SourceManager &SourceMgr; HeaderSearch &HeaderInfo; - + std::vector PredefineBuffer; + bool InitializeSourceMgr; + public: - DriverPreprocessorFactory(Diagnostic &diags, const LangOptions &opts, + DriverPreprocessorFactory(const std::string &infile, + Diagnostic &diags, const LangOptions &opts, TargetInfo &target, SourceManager &SM, HeaderSearch &Headers) - : Diags(diags), LangInfo(opts), Target(target), - SourceMgr(SM), HeaderInfo(Headers) {} + : InFile(infile), Diags(diags), LangInfo(opts), Target(target), + SourceMgr(SM), HeaderInfo(Headers), InitializeSourceMgr(true) {} + virtual ~DriverPreprocessorFactory() {} virtual Preprocessor* CreatePreprocessor() { - return new Preprocessor(Diags, LangInfo, Target, SourceMgr, HeaderInfo); + PredefineBuffer.clear(); + + Preprocessor* PP = new Preprocessor(Diags, LangInfo, Target, + SourceMgr, HeaderInfo); + + if (!InitializePreprocessor(*PP, InitializeSourceMgr, InFile, + PredefineBuffer)) { + delete PP; + return NULL; + } + + InitializeSourceMgr = false; + + return PP; } }; } @@ -1060,6 +1088,7 @@ static ASTConsumer* CreateASTConsumer(const std::string& InFile, Diagnostic& Diag, FileManager& FileMgr, const LangOptions& LangOpts, Preprocessor *PP, + PreprocessorFactory *PPF, llvm::Module *&DestModule) { switch (ProgAction) { default: @@ -1075,7 +1104,7 @@ static ASTConsumer* CreateASTConsumer(const std::string& InFile, return CreateASTViewer(); case EmitHTML: - return CreateHTMLPrinter(OutputFile, Diag, PP); + return CreateHTMLPrinter(OutputFile, Diag, PP, PPF); case ParseCFGDump: case ParseCFGView: @@ -1092,12 +1121,12 @@ static ASTConsumer* CreateASTConsumer(const std::string& InFile, return CreateUnitValsChecker(Diag); case AnalysisGRSimpleVals: - return CreateGRSimpleVals(Diag, PP, AnalyzeSpecificFunction, OutputFile, - VisualizeEG, TrimGraph, AnalyzeAll); + return CreateGRSimpleVals(Diag, PP, PPF, AnalyzeSpecificFunction, + OutputFile, VisualizeEG, TrimGraph, AnalyzeAll); case CheckerCFRef: - return CreateCFRefChecker(Diag, PP, AnalyzeSpecificFunction, OutputFile, - VisualizeEG, TrimGraph, AnalyzeAll); + return CreateCFRefChecker(Diag, PP, PPF, AnalyzeSpecificFunction, + OutputFile, VisualizeEG, TrimGraph, AnalyzeAll); case TestSerialization: return CreateSerializationTest(Diag, FileMgr, LangOpts); @@ -1118,7 +1147,8 @@ static ASTConsumer* CreateASTConsumer(const std::string& InFile, /// ProcessInputFile - Process a single input file with the specified state. /// -static void ProcessInputFile(Preprocessor &PP, const std::string &InFile) { +static void ProcessInputFile(Preprocessor &PP, PreprocessorFactory &PPF, + const std::string &InFile) { ASTConsumer* Consumer = NULL; bool ClearSourceMgr = false; @@ -1128,7 +1158,7 @@ static void ProcessInputFile(Preprocessor &PP, const std::string &InFile) { default: Consumer = CreateASTConsumer(InFile, PP.getDiagnostics(), PP.getFileManager(), PP.getLangOptions(), &PP, - CodeGenModule); + &PPF, CodeGenModule); if (!Consumer) { fprintf(stderr, "Unexpected program action!\n"); @@ -1267,7 +1297,7 @@ static void ProcessSerializedFile(const std::string& InFile, Diagnostic& Diag, // translation unit, rather than InFile. llvm::Module *DestModule; llvm::OwningPtr - Consumer(CreateASTConsumer(InFile, Diag, FileMgr, TU->getLangOpts(), 0, + Consumer(CreateASTConsumer(InFile, Diag, FileMgr, TU->getLangOpts(), 0, 0, DestModule)); if (!Consumer) { @@ -1320,7 +1350,7 @@ int main(int argc, char **argv) { // FIXME: The HTMLDiagnosticClient uses the Preprocessor for // (optional) syntax highlighting, but we don't have a preprocessor yet. // Fix this dependency later. - DiagClient.reset(CreateHTMLDiagnosticClient(HTMLDiag, NULL)); + DiagClient.reset(CreateHTMLDiagnosticClient(HTMLDiag, 0, 0)); } else { // Use Text diagnostics. if (!VerifyDiagnostics) { @@ -1387,16 +1417,15 @@ int main(int argc, char **argv) { InitializeIncludePaths(argv[0], HeaderInfo, FileMgr, LangInfo); // Set up the preprocessor with these options. - DriverPreprocessorFactory PPFactory(Diags, LangInfo, *Target, + DriverPreprocessorFactory PPFactory(InFile, Diags, LangInfo, *Target, SourceMgr, HeaderInfo); llvm::OwningPtr PP(PPFactory.CreatePreprocessor()); - std::vector PredefineBuffer; - if (!InitializePreprocessor(*PP, InFile, PredefineBuffer)) + if (!PP) continue; - ProcessInputFile(*PP, InFile); + ProcessInputFile(*PP, PPFactory, InFile); HeaderInfo.ClearFileInfo(); if (Stats) diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index 5fc4642dd8..6a0255e051 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -196,6 +196,8 @@ public: /// void setMacroInfo(IdentifierInfo *II, MacroInfo *MI); + /// setPredefines - Set the predefines for this Preprocessor. + /// The Preprocessor assumes ownership of this pointer. void setPredefines(const char *P) { Predefines = P; } diff --git a/include/clang/Rewrite/HTMLRewrite.h b/include/clang/Rewrite/HTMLRewrite.h index ded431f156..8c708400ac 100644 --- a/include/clang/Rewrite/HTMLRewrite.h +++ b/include/clang/Rewrite/HTMLRewrite.h @@ -22,6 +22,7 @@ namespace clang { class Rewriter; class Preprocessor; +class PreprocessorFactory; namespace html { @@ -74,7 +75,7 @@ namespace html { /// file, to reexpand macros and insert (into the HTML) information about the /// macro expansions. This won't be perfectly perfect, but it will be /// reasonably close. - void HighlightMacros(Rewriter &R, unsigned FileID, Preprocessor &PP); + void HighlightMacros(Rewriter &R, unsigned FileID, PreprocessorFactory &PPF); diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 6d08a36fde..370244b8f6 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -112,6 +112,8 @@ Preprocessor::~Preprocessor() { delete ScratchBuf; delete Callbacks; + + delete [] Predefines; } /// Diag - Forwarding function for diagnostics. This emits a diagnostic at diff --git a/lib/Rewrite/HTMLRewrite.cpp b/lib/Rewrite/HTMLRewrite.cpp index fd671821f6..ced8e5e938 100644 --- a/lib/Rewrite/HTMLRewrite.cpp +++ b/lib/Rewrite/HTMLRewrite.cpp @@ -12,11 +12,13 @@ // //===----------------------------------------------------------------------===// +#include "clang/Lex/Preprocessor.h" #include "clang/Rewrite/Rewriter.h" #include "clang/Rewrite/HTMLRewrite.h" #include "clang/Lex/Preprocessor.h" #include "clang/Basic/SourceManager.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/OwningPtr.h" #include "llvm/Support/MemoryBuffer.h" #include using namespace clang; @@ -382,23 +384,28 @@ void html::SyntaxHighlight(Rewriter &R, unsigned FileID, Preprocessor &PP) { /// file, to reexpand macros and insert (into the HTML) information about the /// macro expansions. This won't be perfectly perfect, but it will be /// reasonably close. -void html::HighlightMacros(Rewriter &R, unsigned FileID, Preprocessor &PP) { +void html::HighlightMacros(Rewriter &R, unsigned FileID, + PreprocessorFactory &PPF) { + + llvm::OwningPtr PP(PPF.CreatePreprocessor()); + + RewriteBuffer &RB = R.getEditBuffer(FileID); // Inform the preprocessor that we don't want comments. - PP.SetCommentRetentionState(false, false); + PP->SetCommentRetentionState(false, false); // Start parsing the specified input file. - PP.EnterMainSourceFile(); + PP->EnterMainSourceFile(); // Lex all the tokens. - const SourceManager &SourceMgr = PP.getSourceManager(); + const SourceManager &SourceMgr = PP->getSourceManager(); Token Tok; - PP.Lex(Tok); + PP->Lex(Tok); while (Tok.isNot(tok::eof)) { // Ignore non-macro tokens. if (!Tok.getLocation().isMacroID()) { - PP.Lex(Tok); + PP->Lex(Tok); continue; } @@ -408,7 +415,7 @@ void html::HighlightMacros(Rewriter &R, unsigned FileID, Preprocessor &PP) { SourceMgr.getDecomposedFileLoc(LLoc); if (LLocInfo.first != FileID) { - PP.Lex(Tok); + PP->Lex(Tok); continue; } @@ -426,11 +433,11 @@ void html::HighlightMacros(Rewriter &R, unsigned FileID, Preprocessor &PP) { strlen("")); RB.InsertTextBefore(TokOffs+TokLen, "", strlen("")); - std::string Expansion = PP.getSpelling(Tok); + std::string Expansion = PP->getSpelling(Tok); unsigned LineLen = Expansion.size(); // Okay, eat this token, getting the next one. - PP.Lex(Tok); + PP->Lex(Tok); // Skip all the rest of the tokens that are part of this macro // instantiation. It would be really nice to pop up a window with all the @@ -444,9 +451,9 @@ void html::HighlightMacros(Rewriter &R, unsigned FileID, Preprocessor &PP) { } LineLen -= Expansion.size(); - Expansion += ' ' + PP.getSpelling(Tok); + Expansion += ' ' + PP->getSpelling(Tok); LineLen += Expansion.size(); - PP.Lex(Tok); + PP->Lex(Tok); } // Insert the information about the expansion inside the macro span.