clang 8.0.0

FrontendActions.h
Go to the documentation of this file.
1 //===-- FrontendActions.h - Useful Frontend Actions -------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_REWRITE_FRONTEND_FRONTENDACTIONS_H
11 #define LLVM_CLANG_REWRITE_FRONTEND_FRONTENDACTIONS_H
12
13 #include "clang/Frontend/FrontendAction.h"
14 #include "llvm/Support/raw_ostream.h"
15
16 namespace clang {
17 class FixItRewriter;
18 class FixItOptions;
19
20 //===----------------------------------------------------------------------===//
21 // AST Consumer Actions
22 //===----------------------------------------------------------------------===//
23
24 class HTMLPrintAction : public ASTFrontendAction {
25 protected:
26 std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
27 StringRef InFile) override;
28 };
29
30 class FixItAction : public ASTFrontendAction {
31 protected:
32 std::unique_ptr<FixItRewriter> Rewriter;
33 std::unique_ptr<FixItOptions> FixItOpts;
34
35 std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
36 StringRef InFile) override;
37
38 bool BeginSourceFileAction(CompilerInstance &CI) override;
39
40 void EndSourceFileAction() override;
41
42 bool hasASTFileSupport() const override { return false; }
43
44 public:
45 FixItAction();
46 ~FixItAction() override;
47 };
48
49 /// Emits changes to temporary files and uses them for the original
50 /// frontend action.
51 class FixItRecompile : public WrapperFrontendAction {
52 public:
53 FixItRecompile(std::unique_ptr<FrontendAction> WrappedAction)
54 : WrapperFrontendAction(std::move(WrappedAction)) {}
55
56 protected:
57 bool BeginInvocation(CompilerInstance &CI) override;
58 };
59
60 class RewriteObjCAction : public ASTFrontendAction {
61 protected:
62 std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
63 StringRef InFile) override;
64 };
65
66 class RewriteMacrosAction : public PreprocessorFrontendAction {
67 protected:
68 void ExecuteAction() override;
69 };
70
71 class RewriteTestAction : public PreprocessorFrontendAction {
72 protected:
73 void ExecuteAction() override;
74 };
75
76 class RewriteIncludesAction : public PreprocessorFrontendAction {
77 std::shared_ptr<raw_ostream> OutputStream;
78 class RewriteImportsListener;
79 protected:
80 bool BeginSourceFileAction(CompilerInstance &CI) override;
81 void ExecuteAction() override;
82 };
83
84 } // end namespace clang
85
86 #endif
clang::FixItAction::FixItOpts
std::unique_ptr< FixItOptions > FixItOpts
Definition: FrontendActions.h:33
clang::HTMLPrintAction::CreateASTConsumer
std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override
Create the AST consumer object for this action, if supported.
Definition: FrontendActions.cpp:41
clang::ASTFrontendAction::ExecuteAction
void ExecuteAction() override
Implement the ExecuteAction interface by running Sema on the already-initialized AST consumer...
Definition: FrontendAction.cpp:1017
clang::FixItRecompile::FixItRecompile
FixItRecompile(std::unique_ptr< FrontendAction > WrappedAction)
Definition: FrontendActions.h:53
clang::FixItAction::hasASTFileSupport
bool hasASTFileSupport() const override
Does this action support use with AST files?
Definition: FrontendActions.h:42
std
Definition: Format.h:2072
clang::FixItAction::Rewriter
std::unique_ptr< FixItRewriter > Rewriter
Definition: FrontendActions.h:32
clang::FrontendAction::BeginInvocation
virtual bool BeginInvocation(CompilerInstance &CI)
Callback before starting processing a single input, giving the opportunity to modify the CompilerInvo...
Definition: FrontendAction.h:79
clang::FrontendAction::EndSourceFileAction
virtual void EndSourceFileAction()
Callback at the end of processing a single input.
Definition: FrontendAction.h:100
clang::RewriteTestAction
Definition: FrontendActions.h:71
clang::CompilerInstance
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
Definition: CompilerInstance.h:73
clang::FixItAction
Definition: FrontendActions.h:30
clang::FixItRecompile
Emits changes to temporary files and uses them for the original frontend action.
Definition: FrontendActions.h:51
clang::RewriteObjCAction
Definition: FrontendActions.h:60
clang::ASTFrontendAction
Abstract base class to use for AST consumer-based frontend actions.
Definition: FrontendAction.h:243
clang::PreprocessorFrontendAction
Abstract base class to use for preprocessor-based frontend actions.
Definition: FrontendAction.h:287
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
clang::RewriteIncludesAction
Definition: FrontendActions.h:76
clang::WrapperFrontendAction
A frontend action which simply wraps some other runtime-specified frontend action.
Definition: FrontendAction.h:304
clang::FrontendAction::BeginSourceFileAction
virtual bool BeginSourceFileAction(CompilerInstance &CI)
Callback at the start of processing a single input.
Definition: FrontendAction.h:85
clang::RewriteIncludesAction::RewriteImportsListener
Definition: FrontendActions.cpp:199
clang::HTMLPrintAction
Definition: FrontendActions.h:24
FrontendAction.h
Defines the clang::FrontendAction interface and various convenience abstract classes (clang::ASTFront...
clang::RewriteMacrosAction
Definition: FrontendActions.h:66