clang API Documentation

StaticAnalyzer/Frontend/FrontendActions.h
Go to the documentation of this file.
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_STATICANALYZER_FRONTEND_FRONTENDACTIONS_H
00011 #define LLVM_CLANG_STATICANALYZER_FRONTEND_FRONTENDACTIONS_H
00012 
00013 #include "clang/Frontend/FrontendAction.h"
00014 #include "llvm/ADT/StringRef.h"
00015 #include "llvm/ADT/StringMap.h"
00016 
00017 namespace clang {
00018 
00019 class Stmt;
00020 
00021 namespace ento {
00022 
00023 //===----------------------------------------------------------------------===//
00024 // AST Consumer Actions
00025 //===----------------------------------------------------------------------===//
00026 
00027 class AnalysisAction : public ASTFrontendAction {
00028 protected:
00029   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
00030                                                  StringRef InFile) override;
00031 };
00032 
00033 /// \brief Frontend action to parse model files.
00034 ///
00035 /// This frontend action is responsible for parsing model files. Model files can
00036 /// not be parsed on their own, they rely on type information that is available
00037 /// in another translation unit. The parsing of model files is done by a
00038 /// separate compiler instance that reuses the ASTContext and othen information
00039 /// from the main translation unit that is being compiled. After a model file is
00040 /// parsed, the function definitions will be collected into a StringMap.
00041 class ParseModelFileAction : public ASTFrontendAction {
00042 public:
00043   ParseModelFileAction(llvm::StringMap<Stmt *> &Bodies);
00044   bool isModelParsingAction() const override { return true; }
00045 
00046 protected:
00047   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
00048                                                  StringRef InFile) override;
00049 
00050 private:
00051   llvm::StringMap<Stmt *> &Bodies;
00052 };
00053 
00054 void printCheckerHelp(raw_ostream &OS, ArrayRef<std::string> plugins);
00055 
00056 } // end GR namespace
00057 
00058 } // end namespace clang
00059 
00060 #endif