Home | History | Annotate | Download | only in Rewrite
      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 
     15 namespace clang {
     16 class FixItRewriter;
     17 class FixItOptions;
     18 
     19 //===----------------------------------------------------------------------===//
     20 // AST Consumer Actions
     21 //===----------------------------------------------------------------------===//
     22 
     23 class HTMLPrintAction : public ASTFrontendAction {
     24 protected:
     25   virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
     26                                          StringRef InFile);
     27 };
     28 
     29 class FixItAction : public ASTFrontendAction {
     30 protected:
     31   llvm::OwningPtr<FixItRewriter> Rewriter;
     32   llvm::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 
     44 public:
     45   FixItAction();
     46   ~FixItAction();
     47 };
     48 
     49 class RewriteObjCAction : public ASTFrontendAction {
     50 protected:
     51   virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
     52                                          StringRef InFile);
     53 };
     54 
     55 class RewriteMacrosAction : public PreprocessorFrontendAction {
     56 protected:
     57   void ExecuteAction();
     58 };
     59 
     60 class RewriteTestAction : public PreprocessorFrontendAction {
     61 protected:
     62   void ExecuteAction();
     63 };
     64 
     65 }  // end namespace clang
     66 
     67 #endif
     68