FrontendActions.h revision 305c613af6cfc40e519c75d9d2c84c6fa9a841c0
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_FRONTENDACTIONS_H 11#define LLVM_CLANG_REWRITE_FRONTENDACTIONS_H 12 13#include "clang/Frontend/FrontendAction.h" 14 15namespace clang { 16class FixItRewriter; 17class FixItOptions; 18 19//===----------------------------------------------------------------------===// 20// AST Consumer Actions 21//===----------------------------------------------------------------------===// 22 23class HTMLPrintAction : public ASTFrontendAction { 24protected: 25 virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, 26 StringRef InFile); 27}; 28 29class FixItAction : public ASTFrontendAction { 30protected: 31 OwningPtr<FixItRewriter> Rewriter; 32 OwningPtr<FixItOptions> FixItOpts; 33 34 virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, 35 StringRef InFile); 36 37 virtual bool BeginSourceFileAction(CompilerInstance &CI, 38 StringRef Filename); 39 40 virtual void EndSourceFileAction(); 41 42 virtual bool hasASTFileSupport() const { return false; } 43 44public: 45 FixItAction(); 46 ~FixItAction(); 47}; 48 49/// \brief Emits changes to temporary files and uses them for the original 50/// frontend action. 51class FixItRecompile : public WrapperFrontendAction { 52public: 53 FixItRecompile(FrontendAction *WrappedAction) 54 : WrapperFrontendAction(WrappedAction) {} 55 56protected: 57 virtual bool BeginInvocation(CompilerInstance &CI); 58}; 59 60class RewriteObjCAction : public ASTFrontendAction { 61protected: 62 virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, 63 StringRef InFile); 64}; 65 66class RewriteMacrosAction : public PreprocessorFrontendAction { 67protected: 68 void ExecuteAction(); 69}; 70 71class RewriteTestAction : public PreprocessorFrontendAction { 72protected: 73 void ExecuteAction(); 74}; 75 76class RewriteIncludesAction : public PreprocessorFrontendAction { 77protected: 78 void ExecuteAction(); 79}; 80 81} // end namespace clang 82 83#endif 84