clang API Documentation
00001 //===-- FrontendActions.h - Useful Frontend Actions -------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 00010 #ifndef LLVM_CLANG_REWRITE_FRONTENDACTIONS_H 00011 #define LLVM_CLANG_REWRITE_FRONTENDACTIONS_H 00012 00013 #include "clang/Frontend/FrontendAction.h" 00014 00015 namespace clang { 00016 class FixItRewriter; 00017 class FixItOptions; 00018 00019 //===----------------------------------------------------------------------===// 00020 // AST Consumer Actions 00021 //===----------------------------------------------------------------------===// 00022 00023 class HTMLPrintAction : public ASTFrontendAction { 00024 protected: 00025 virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, 00026 StringRef InFile); 00027 }; 00028 00029 class FixItAction : public ASTFrontendAction { 00030 protected: 00031 OwningPtr<FixItRewriter> Rewriter; 00032 OwningPtr<FixItOptions> FixItOpts; 00033 00034 virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, 00035 StringRef InFile); 00036 00037 virtual bool BeginSourceFileAction(CompilerInstance &CI, 00038 StringRef Filename); 00039 00040 virtual void EndSourceFileAction(); 00041 00042 virtual bool hasASTFileSupport() const { return false; } 00043 00044 public: 00045 FixItAction(); 00046 ~FixItAction(); 00047 }; 00048 00049 /// \brief Emits changes to temporary files and uses them for the original 00050 /// frontend action. 00051 class FixItRecompile : public WrapperFrontendAction { 00052 public: 00053 FixItRecompile(FrontendAction *WrappedAction) 00054 : WrapperFrontendAction(WrappedAction) {} 00055 00056 protected: 00057 virtual bool BeginInvocation(CompilerInstance &CI); 00058 }; 00059 00060 class RewriteObjCAction : public ASTFrontendAction { 00061 protected: 00062 virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, 00063 StringRef InFile); 00064 }; 00065 00066 class RewriteMacrosAction : public PreprocessorFrontendAction { 00067 protected: 00068 void ExecuteAction(); 00069 }; 00070 00071 class RewriteTestAction : public PreprocessorFrontendAction { 00072 protected: 00073 void ExecuteAction(); 00074 }; 00075 00076 } // end namespace clang 00077 00078 #endif