clang  19.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 
20 namespace ento {
21 
22 //===----------------------------------------------------------------------===//
23 // AST Consumer Actions
24 //===----------------------------------------------------------------------===//
25 
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.
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
Defines the clang::FrontendAction interface and various convenience abstract classes (clang::ASTFront...
Abstract base class to use for AST consumer-based frontend actions.
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override
Create the AST consumer object for this action, if supported.
Frontend action to parse model files.
ParseModelFileAction(llvm::StringMap< Stmt * > &Bodies)
std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override
Create the AST consumer object for this action, if supported.
bool isModelParsingAction() const override
Is this action invoked on a model file?
The JSON file list parser is used to communicate input to InstallAPI.