Nebiroth updated this revision to Diff 126984.
Nebiroth marked an inline comment as done.
Nebiroth added a comment.
Minor code cleanup
Repository:
rC Clang
https://reviews.llvm.org/D39375
Files:
include/clang/Frontend/PrecompiledPreamble.h
lib/Frontend/PrecompiledPreamble.cpp
Index: lib/Frontend/PrecompiledPreamble.cpp
===================================================================
--- lib/Frontend/PrecompiledPreamble.cpp
+++ lib/Frontend/PrecompiledPreamble.cpp
@@ -351,6 +351,10 @@
if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0]))
return BuildPreambleError::BeginSourceFileFailed;
+ std::unique_ptr<PPCallbacks> DelegatedPPCallbacks =
Callbacks.createPPCallbacks();
+
+ if (DelegatedPPCallbacks)
+ Clang->getPreprocessor().addPPCallbacks(std::move(DelegatedPPCallbacks));
Act->Execute();
// Run the callbacks.
@@ -709,6 +713,7 @@
void PreambleCallbacks::HandleTopLevelDecl(DeclGroupRef DG) {}
void PreambleCallbacks::HandleMacroDefined(const Token &MacroNameTok,
const MacroDirective *MD) {}
+std::unique_ptr<PPCallbacks> PreambleCallbacks::createPPCallbacks() {return
nullptr;}
std::error_code clang::make_error_code(BuildPreambleError Error) {
return std::error_code(static_cast<int>(Error),
BuildPreambleErrorCategory());
Index: include/clang/Frontend/PrecompiledPreamble.h
===================================================================
--- include/clang/Frontend/PrecompiledPreamble.h
+++ include/clang/Frontend/PrecompiledPreamble.h
@@ -260,6 +260,9 @@
/// used instead, but having only this method allows a simpler API.
virtual void HandleMacroDefined(const Token &MacroNameTok,
const MacroDirective *MD);
+ /// Creates wrapper class for PPCallbacks so we can also process information
+ /// about includes that are inside of a preamble
+ virtual std::unique_ptr<PPCallbacks> createPPCallbacks();
};
enum class BuildPreambleError {
Index: lib/Frontend/PrecompiledPreamble.cpp
===================================================================
--- lib/Frontend/PrecompiledPreamble.cpp
+++ lib/Frontend/PrecompiledPreamble.cpp
@@ -351,6 +351,10 @@
if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0]))
return BuildPreambleError::BeginSourceFileFailed;
+ std::unique_ptr<PPCallbacks> DelegatedPPCallbacks = Callbacks.createPPCallbacks();
+
+ if (DelegatedPPCallbacks)
+ Clang->getPreprocessor().addPPCallbacks(std::move(DelegatedPPCallbacks));
Act->Execute();
// Run the callbacks.
@@ -709,6 +713,7 @@
void PreambleCallbacks::HandleTopLevelDecl(DeclGroupRef DG) {}
void PreambleCallbacks::HandleMacroDefined(const Token &MacroNameTok,
const MacroDirective *MD) {}
+std::unique_ptr<PPCallbacks> PreambleCallbacks::createPPCallbacks() {return nullptr;}
std::error_code clang::make_error_code(BuildPreambleError Error) {
return std::error_code(static_cast<int>(Error), BuildPreambleErrorCategory());
Index: include/clang/Frontend/PrecompiledPreamble.h
===================================================================
--- include/clang/Frontend/PrecompiledPreamble.h
+++ include/clang/Frontend/PrecompiledPreamble.h
@@ -260,6 +260,9 @@
/// used instead, but having only this method allows a simpler API.
virtual void HandleMacroDefined(const Token &MacroNameTok,
const MacroDirective *MD);
+ /// Creates wrapper class for PPCallbacks so we can also process information
+ /// about includes that are inside of a preamble
+ virtual std::unique_ptr<PPCallbacks> createPPCallbacks();
};
enum class BuildPreambleError {
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits