clang  14.0.0git
FrontendActions.h
Go to the documentation of this file.
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 
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 
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.
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
clang::ento::ParseModelFileAction
Frontend action to parse model files.
Definition: FrontendActions.h:43
FrontendAction.h
clang::ento::AnalysisAction
Definition: FrontendActions.h:29
clang::CompilerInstance
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
Definition: CompilerInstance.h:74
clang::ento::ParseModelFileAction::CreateASTConsumer
std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override
Create the AST consumer object for this action, if supported.
Definition: FrontendActions.cpp:24
clang::ento::AnalysisAction::CreateASTConsumer
std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override
Create the AST consumer object for this action, if supported.
Definition: FrontendActions.cpp:16
clang::ento::ParseModelFileAction::isModelParsingAction
bool isModelParsingAction() const override
Is this action invoked on a model file?
Definition: FrontendActions.h:46
clang
Definition: CalledOnceCheck.h:17
clang::ASTFrontendAction
Abstract base class to use for AST consumer-based frontend actions.
Definition: FrontendAction.h:243
clang::ento::ParseModelFileAction::ParseModelFileAction
ParseModelFileAction(llvm::StringMap< Stmt * > &Bodies)
Definition: FrontendActions.cpp:20