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_STATICANALYZER_FRONTEND_FRONTENDACTIONS_H 11 #define LLVM_CLANG_STATICANALYZER_FRONTEND_FRONTENDACTIONS_H 12 13 #include "clang/Frontend/FrontendAction.h" 14 #include "llvm/ADT/StringMap.h" 15 #include "llvm/ADT/StringRef.h" 16 17 namespace clang { 18 19 class Stmt; 20 21 namespace ento { 22 23 //===----------------------------------------------------------------------===// 24 // AST Consumer Actions 25 //===----------------------------------------------------------------------===// 26 27 class AnalysisAction : public ASTFrontendAction { 28 protected: 29 std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, 30 StringRef InFile) override; 31 }; 32 33 /// \brief Frontend action to parse model files. 34 /// 35 /// This frontend action is responsible for parsing model files. Model files can 36 /// not be parsed on their own, they rely on type information that is available 37 /// in another translation unit. The parsing of model files is done by a 38 /// separate compiler instance that reuses the ASTContext and othen information 39 /// from the main translation unit that is being compiled. After a model file is 40 /// parsed, the function definitions will be collected into a StringMap. 41 class ParseModelFileAction : public ASTFrontendAction { 42 public: 43 ParseModelFileAction(llvm::StringMap<Stmt *> &Bodies); isModelParsingAction()44 bool isModelParsingAction() const override { return true; } 45 46 protected: 47 std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, 48 StringRef InFile) override; 49 50 private: 51 llvm::StringMap<Stmt *> &Bodies; 52 }; 53 54 void printCheckerHelp(raw_ostream &OS, ArrayRef<std::string> plugins); 55 56 } // end GR namespace 57 58 } // end namespace clang 59 60 #endif 61