//===- AnalyzerOptions.h - Analysis Engine Options --------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This header defines various options for the static analyzer that are set // by the frontend and are consulted throughout the analyzer. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_STATICANALYZER_CORE_ANALYZEROPTIONS_H #define LLVM_CLANG_STATICANALYZER_CORE_ANALYZEROPTIONS_H #include "clang/Analysis/PathDiagnostic.h" #include "clang/Basic/LLVM.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include <string> #include <utility> #include <vector> namespace clang { namespace ento { class CheckerBase; } // namespace ento /// AnalysisConstraints - Set of available constraint models. enum AnalysisConstraints { … }; /// AnalysisDiagClients - Set of available diagnostic clients for rendering /// analysis results. enum AnalysisDiagClients { … }; /// AnalysisPurgeModes - Set of available strategies for dead symbol removal. enum AnalysisPurgeMode { … }; /// AnalysisInlineFunctionSelection - Set of inlining function selection heuristics. enum AnalysisInliningMode { … }; /// Describes the different kinds of C++ member functions which can be /// considered for inlining by the analyzer. /// /// These options are cumulative; enabling one kind of member function will /// enable all kinds with lower enum values. enum CXXInlineableMemberKind { … }; /// Describes the different modes of inter-procedural analysis. enum IPAKind { … }; enum class ExplorationStrategyKind { … }; /// Describes the kinds for high-level analyzer mode. enum UserModeKind { … }; enum class CTUPhase1InliningKind { … }; /// Stores options for the analyzer from the command line. /// /// Some options are frontend flags (e.g.: -analyzer-output), but some are /// analyzer configuration options, which are preceded by -analyzer-config /// (e.g.: -analyzer-config notes-as-events=true). /// /// If you'd like to add a new frontend flag, add it to /// include/clang/Driver/CC1Options.td, add a new field to store the value of /// that flag in this class, and initialize it in /// lib/Frontend/CompilerInvocation.cpp. /// /// If you'd like to add a new non-checker configuration, register it in /// include/clang/StaticAnalyzer/Core/AnalyzerOptions.def, and refer to the /// top of the file for documentation. /// /// If you'd like to add a new checker option, call getChecker*Option() /// whenever. /// /// Some of the options are controlled by raw frontend flags for no good reason, /// and should be eventually converted into -analyzer-config flags. New analyzer /// options should not be implemented as frontend flags. Frontend flags still /// make sense for things that do not affect the actual analysis. class AnalyzerOptions : public RefCountedBase<AnalyzerOptions> { … }; AnalyzerOptionsRef; //===----------------------------------------------------------------------===// // We'll use AnalyzerOptions in the frontend, but we can't link the frontend // with clangStaticAnalyzerCore, because clangStaticAnalyzerCore depends on // clangFrontend. // // For this reason, implement some methods in this header file. //===----------------------------------------------------------------------===// inline std::vector<StringRef> AnalyzerOptions::getRegisteredCheckers(bool IncludeExperimental) { … } inline std::vector<StringRef> AnalyzerOptions::getRegisteredPackages(bool IncludeExperimental) { … } } // namespace clang #endif // LLVM_CLANG_STATICANALYZER_CORE_ANALYZEROPTIONS_H