aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Frontend/FrontendActions.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Frontend/FrontendActions.h')
-rw-r--r--include/clang/Frontend/FrontendActions.h39
1 files changed, 25 insertions, 14 deletions
diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h
index 0cbacbb4b122..a073ca5bfd2a 100644
--- a/include/clang/Frontend/FrontendActions.h
+++ b/include/clang/Frontend/FrontendActions.h
@@ -91,11 +91,12 @@ public:
};
class GenerateModuleAction : public ASTFrontendAction {
- clang::Module *Module;
- const FileEntry *ModuleMapForUniquing;
- bool IsSystem;
-
+ virtual std::unique_ptr<raw_pwrite_stream>
+ CreateOutputFile(CompilerInstance &CI, StringRef InFile) = 0;
+
protected:
+ bool BeginSourceFileAction(CompilerInstance &CI, StringRef Filename) override;
+
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
StringRef InFile) override;
@@ -104,22 +105,31 @@ protected:
}
bool hasASTFileSupport() const override { return false; }
+};
+
+class GenerateModuleFromModuleMapAction : public GenerateModuleAction {
+ clang::Module *Module = nullptr;
+ const FileEntry *ModuleMapForUniquing = nullptr;
+ bool IsSystem = false;
+
+private:
+ bool BeginSourceFileAction(CompilerInstance &CI, StringRef Filename) override;
+
+ std::unique_ptr<raw_pwrite_stream>
+ CreateOutputFile(CompilerInstance &CI, StringRef InFile) override;
public:
- GenerateModuleAction(const FileEntry *ModuleMap = nullptr,
- bool IsSystem = false)
- : ASTFrontendAction(), ModuleMapForUniquing(ModuleMap), IsSystem(IsSystem)
- { }
+ GenerateModuleFromModuleMapAction() {}
+ GenerateModuleFromModuleMapAction(const FileEntry *ModuleMap, bool IsSystem)
+ : ModuleMapForUniquing(ModuleMap), IsSystem(IsSystem) {}
+};
+class GenerateModuleInterfaceAction : public GenerateModuleAction {
+private:
bool BeginSourceFileAction(CompilerInstance &CI, StringRef Filename) override;
- /// \brief Compute the AST consumer arguments that will be used to
- /// create the PCHGenerator instance returned by CreateASTConsumer.
- ///
- /// \returns true if an error occurred, false otherwise.
std::unique_ptr<raw_pwrite_stream>
- ComputeASTConsumerArguments(CompilerInstance &CI, StringRef InFile,
- std::string &Sysroot, std::string &OutputFile);
+ CreateOutputFile(CompilerInstance &CI, StringRef InFile) override;
};
class SyntaxOnlyAction : public ASTFrontendAction {
@@ -138,6 +148,7 @@ class DumpModuleInfoAction : public ASTFrontendAction {
protected:
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
StringRef InFile) override;
+ bool BeginInvocation(CompilerInstance &CI) override;
void ExecuteAction() override;
public: