Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 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 | |||
20 | namespace ento { |
||
21 | |||
22 | //===----------------------------------------------------------------------===// |
||
23 | // AST Consumer Actions |
||
24 | //===----------------------------------------------------------------------===// |
||
25 | |||
26 | class AnalysisAction : public ASTFrontendAction { |
||
27 | protected: |
||
28 | std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, |
||
29 | StringRef InFile) override; |
||
30 | }; |
||
31 | |||
32 | /// Frontend action to parse model files. |
||
33 | /// |
||
34 | /// This frontend action is responsible for parsing model files. Model files can |
||
35 | /// not be parsed on their own, they rely on type information that is available |
||
36 | /// in another translation unit. The parsing of model files is done by a |
||
37 | /// separate compiler instance that reuses the ASTContext and othen information |
||
38 | /// from the main translation unit that is being compiled. After a model file is |
||
39 | /// parsed, the function definitions will be collected into a StringMap. |
||
40 | class ParseModelFileAction : public ASTFrontendAction { |
||
41 | public: |
||
42 | ParseModelFileAction(llvm::StringMap<Stmt *> &Bodies); |
||
43 | bool isModelParsingAction() const override { return true; } |
||
44 | |||
45 | protected: |
||
46 | std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, |
||
47 | StringRef InFile) override; |
||
48 | |||
49 | private: |
||
50 | llvm::StringMap<Stmt *> &Bodies; |
||
51 | }; |
||
52 | |||
53 | } // namespace ento |
||
54 | } // end namespace clang |
||
55 | |||
56 | #endif |