Home | History | Annotate | Line # | Download | only in Frontend
      1 //===-- FrontendActions.h - Useful Frontend Actions -------------*- C++ -*-===//
      2 //
      3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
      4 // See https://llvm.org/LICENSE.txt for license information.
      5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
      6 //
      7 //===----------------------------------------------------------------------===//
      8 
      9 #ifndef LLVM_CLANG_STATICANALYZER_FRONTEND_FRONTENDACTIONS_H
     10 #define LLVM_CLANG_STATICANALYZER_FRONTEND_FRONTENDACTIONS_H
     11 
     12 #include "clang/Frontend/FrontendAction.h"
     13 #include "llvm/ADT/StringMap.h"
     14 #include "llvm/ADT/StringRef.h"
     15 
     16 namespace clang {
     17 
     18 class Stmt;
     19 class AnalyzerOptions;
     20 
     21 namespace ento {
     22 
     23 class CheckerManager;
     24 
     25 //===----------------------------------------------------------------------===//
     26 // AST Consumer Actions
     27 //===----------------------------------------------------------------------===//
     28 
     29 class AnalysisAction : public ASTFrontendAction {
     30 protected:
     31   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
     32                                                  StringRef InFile) override;
     33 };
     34 
     35 /// Frontend action to parse model files.
     36 ///
     37 /// This frontend action is responsible for parsing model files. Model files can
     38 /// not be parsed on their own, they rely on type information that is available
     39 /// in another translation unit. The parsing of model files is done by a
     40 /// separate compiler instance that reuses the ASTContext and othen information
     41 /// from the main translation unit that is being compiled. After a model file is
     42 /// parsed, the function definitions will be collected into a StringMap.
     43 class ParseModelFileAction : public ASTFrontendAction {
     44 public:
     45   ParseModelFileAction(llvm::StringMap<Stmt *> &Bodies);
     46   bool isModelParsingAction() const override { return true; }
     47 
     48 protected:
     49   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
     50                                                  StringRef InFile) override;
     51 
     52 private:
     53   llvm::StringMap<Stmt *> &Bodies;
     54 };
     55 
     56 } // namespace ento
     57 } // end namespace clang
     58 
     59 #endif
     60