This revision was automatically updated to reflect the committed changes. Closed by commit rGbad897778638: [clang] Change ordering of PreableCallbacks to make sure PP can be referenced… (authored by kbobyrev).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114525/new/ https://reviews.llvm.org/D114525 Files: clang/include/clang/Frontend/PrecompiledPreamble.h clang/lib/Frontend/PrecompiledPreamble.cpp Index: clang/lib/Frontend/PrecompiledPreamble.cpp =================================================================== --- clang/lib/Frontend/PrecompiledPreamble.cpp +++ clang/lib/Frontend/PrecompiledPreamble.cpp @@ -412,10 +412,13 @@ std::unique_ptr<PrecompilePreambleAction> Act; Act.reset(new PrecompilePreambleAction( StoreInMemory ? &Storage.asMemory().Data : nullptr, Callbacks)); - Callbacks.BeforeExecute(*Clang); if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) return BuildPreambleError::BeginSourceFileFailed; + // Performed after BeginSourceFile to ensure Clang->Preprocessor can be + // referenced in the callback. + Callbacks.BeforeExecute(*Clang); + std::unique_ptr<PPCallbacks> DelegatedPPCallbacks = Callbacks.createPPCallbacks(); if (DelegatedPPCallbacks) Index: clang/include/clang/Frontend/PrecompiledPreamble.h =================================================================== --- clang/include/clang/Frontend/PrecompiledPreamble.h +++ clang/include/clang/Frontend/PrecompiledPreamble.h @@ -274,7 +274,7 @@ public: virtual ~PreambleCallbacks() = default; - /// Called before FrontendAction::BeginSourceFile. + /// Called before FrontendAction::Execute. /// Can be used to store references to various CompilerInstance fields /// (e.g. SourceManager) that may be interesting to the consumers of other /// callbacks. @@ -291,7 +291,7 @@ /// used instead, but having only this method allows a simpler API. virtual void HandleTopLevelDecl(DeclGroupRef DG); /// Creates wrapper class for PPCallbacks so we can also process information - /// about includes that are inside of a preamble + /// about includes that are inside of a preamble. Called after BeforeExecute. virtual std::unique_ptr<PPCallbacks> createPPCallbacks(); /// The returned CommentHandler will be added to the preprocessor if not null. virtual CommentHandler *getCommentHandler();
Index: clang/lib/Frontend/PrecompiledPreamble.cpp =================================================================== --- clang/lib/Frontend/PrecompiledPreamble.cpp +++ clang/lib/Frontend/PrecompiledPreamble.cpp @@ -412,10 +412,13 @@ std::unique_ptr<PrecompilePreambleAction> Act; Act.reset(new PrecompilePreambleAction( StoreInMemory ? &Storage.asMemory().Data : nullptr, Callbacks)); - Callbacks.BeforeExecute(*Clang); if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0])) return BuildPreambleError::BeginSourceFileFailed; + // Performed after BeginSourceFile to ensure Clang->Preprocessor can be + // referenced in the callback. + Callbacks.BeforeExecute(*Clang); + std::unique_ptr<PPCallbacks> DelegatedPPCallbacks = Callbacks.createPPCallbacks(); if (DelegatedPPCallbacks) Index: clang/include/clang/Frontend/PrecompiledPreamble.h =================================================================== --- clang/include/clang/Frontend/PrecompiledPreamble.h +++ clang/include/clang/Frontend/PrecompiledPreamble.h @@ -274,7 +274,7 @@ public: virtual ~PreambleCallbacks() = default; - /// Called before FrontendAction::BeginSourceFile. + /// Called before FrontendAction::Execute. /// Can be used to store references to various CompilerInstance fields /// (e.g. SourceManager) that may be interesting to the consumers of other /// callbacks. @@ -291,7 +291,7 @@ /// used instead, but having only this method allows a simpler API. virtual void HandleTopLevelDecl(DeclGroupRef DG); /// Creates wrapper class for PPCallbacks so we can also process information - /// about includes that are inside of a preamble + /// about includes that are inside of a preamble. Called after BeforeExecute. virtual std::unique_ptr<PPCallbacks> createPPCallbacks(); /// The returned CommentHandler will be added to the preprocessor if not null. virtual CommentHandler *getCommentHandler();
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits