clang 19.0.0git
FrontendActions.h
Go to the documentation of this file.
1//===-- FrontendActions.h - Useful Frontend Actions -------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_REWRITE_FRONTEND_FRONTENDACTIONS_H
10#define LLVM_CLANG_REWRITE_FRONTEND_FRONTENDACTIONS_H
11
13#include "llvm/Support/raw_ostream.h"
14
15namespace clang {
16class FixItRewriter;
17class FixItOptions;
18
19//===----------------------------------------------------------------------===//
20// AST Consumer Actions
21//===----------------------------------------------------------------------===//
22
24protected:
25 std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
26 StringRef InFile) override;
27};
28
30protected:
31 std::unique_ptr<FixItRewriter> Rewriter;
32 std::unique_ptr<FixItOptions> FixItOpts;
33
34 std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
35 StringRef InFile) override;
36
37 bool BeginSourceFileAction(CompilerInstance &CI) override;
38
39 void EndSourceFileAction() override;
40
41 bool hasASTFileSupport() const override { return false; }
42
43public:
45 ~FixItAction() override;
46};
47
48/// Emits changes to temporary files and uses them for the original
49/// frontend action.
51public:
52 FixItRecompile(std::unique_ptr<FrontendAction> WrappedAction)
54
55protected:
56 bool BeginInvocation(CompilerInstance &CI) override;
57};
58
60protected:
61 std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
62 StringRef InFile) override;
63};
64
66protected:
67 void ExecuteAction() override;
68};
69
71protected:
72 void ExecuteAction() override;
73};
74
76 std::shared_ptr<raw_ostream> OutputStream;
78protected:
79 bool BeginSourceFileAction(CompilerInstance &CI) override;
80 void ExecuteAction() override;
81};
82
83} // end namespace clang
84
85#endif
Defines the clang::FrontendAction interface and various convenience abstract classes (clang::ASTFront...
Abstract base class to use for AST consumer-based frontend actions.
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
std::unique_ptr< FixItRewriter > Rewriter
std::unique_ptr< FixItOptions > FixItOpts
void EndSourceFileAction() override
Callback at the end of processing a single input.
bool BeginSourceFileAction(CompilerInstance &CI) override
Callback at the start of processing a single input.
std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override
Create the AST consumer object for this action, if supported.
bool hasASTFileSupport() const override
Does this action support use with AST files?
Emits changes to temporary files and uses them for the original frontend action.
bool BeginInvocation(CompilerInstance &CI) override
Callback before starting processing a single input, giving the opportunity to modify the CompilerInvo...
FixItRecompile(std::unique_ptr< FrontendAction > WrappedAction)
std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override
Create the AST consumer object for this action, if supported.
Abstract base class to use for preprocessor-based frontend actions.
void ExecuteAction() override
Callback to run the program action, using the initialized compiler instance.
bool BeginSourceFileAction(CompilerInstance &CI) override
Callback at the start of processing a single input.
void ExecuteAction() override
Callback to run the program action, using the initialized compiler instance.
std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override
Create the AST consumer object for this action, if supported.
void ExecuteAction() override
Callback to run the program action, using the initialized compiler instance.
A frontend action which simply wraps some other runtime-specified frontend action.
std::unique_ptr< FrontendAction > WrappedAction
The JSON file list parser is used to communicate input to InstallAPI.
Definition: Format.h:5394