1 //===-- FrontendActions.h - Useful Frontend Actions -------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_STATICANALYZER_FRONTEND_FRONTENDACTIONS_H
10 #define LLVM_CLANG_STATICANALYZER_FRONTEND_FRONTENDACTIONS_H
12 #include "clang/Frontend/FrontendAction.h"
13 #include "llvm/ADT/StringMap.h"
14 #include "llvm/ADT/StringRef.h"
19 class AnalyzerOptions;
23 //===----------------------------------------------------------------------===//
24 // AST Consumer Actions
25 //===----------------------------------------------------------------------===//
27 class AnalysisAction : public ASTFrontendAction {
29 std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
30 StringRef InFile) override;
33 /// Frontend action to parse model files.
35 /// This frontend action is responsible for parsing model files. Model files can
36 /// not be parsed on their own, they rely on type information that is available
37 /// in another translation unit. The parsing of model files is done by a
38 /// separate compiler instance that reuses the ASTContext and othen information
39 /// from the main translation unit that is being compiled. After a model file is
40 /// parsed, the function definitions will be collected into a StringMap.
41 class ParseModelFileAction : public ASTFrontendAction {
43 ParseModelFileAction(llvm::StringMap<Stmt *> &Bodies);
44 bool isModelParsingAction() const override { return true; }
47 std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
48 StringRef InFile) override;
51 llvm::StringMap<Stmt *> &Bodies;
54 void printCheckerHelp(raw_ostream &OS,
55 ArrayRef<std::string> plugins,
56 AnalyzerOptions &opts,
57 DiagnosticsEngine &diags,
58 const LangOptions &LangOpts);
59 void printEnabledCheckerList(raw_ostream &OS, ArrayRef<std::string> plugins,
60 AnalyzerOptions &opts,
61 DiagnosticsEngine &diags,
62 const LangOptions &LangOpts);
63 void printAnalyzerConfigList(raw_ostream &OS);
64 void printCheckerConfigList(raw_ostream &OS, ArrayRef<std::string> plugins,
65 AnalyzerOptions &opts,
66 DiagnosticsEngine &diags,
67 const LangOptions &LangOpts);
71 } // end namespace clang