clang 23.0.0git
AnalysisBase.h
Go to the documentation of this file.
1//===- AnalysisBase.h -------------------------------------------*- 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// Minimal common base for SummaryAnalysisBase and DerivedAnalysisBase.
10// Carries the identity (analysisName()) and dependency list
11// (dependencyNames()) shared by every analysis regardless of kind.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_CORE_WHOLEPROGRAMANALYSIS_ANALYSISBASE_H
16#define LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_CORE_WHOLEPROGRAMANALYSIS_ANALYSISBASE_H
17
19#include <vector>
20
21namespace clang::ssaf {
22
23class AnalysisDriver;
24class AnalysisResult;
27
28/// Minimal common base for both analysis kinds.
29///
30/// Not subclassed directly -- use SummaryAnalysis<...> or
31/// DerivedAnalysis<...> instead.
33 friend class AnalysisDriver;
34 friend class DerivedAnalysisBase;
35 friend class SummaryAnalysisBase;
36
37 enum class Kind { Summary, Derived };
38 Kind TheKind;
39
40protected:
41 explicit AnalysisBase(Kind K) : TheKind(K) {}
42
43public:
44 virtual ~AnalysisBase() = default;
45
46 /// Name of this analysis. Equal to ResultT::analysisName() in both typed
47 /// intermediates.
48 virtual AnalysisName analysisName() const = 0;
49
50 /// AnalysisNames of all AnalysisResult dependencies.
51 virtual const std::vector<AnalysisName> &dependencyNames() const = 0;
52
53 /// Transfers ownership of the built result. Called once after finalize().
54 /// The rvalue ref-qualifier enforces single use.
55 virtual std::unique_ptr<AnalysisResult> result() && = 0;
56};
57
58} // namespace clang::ssaf
59
60#endif // LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_CORE_WHOLEPROGRAMANALYSIS_ANALYSISBASE_H
friend class SummaryAnalysisBase
friend class DerivedAnalysisBase
virtual ~AnalysisBase()=default
virtual AnalysisName analysisName() const =0
Name of this analysis.
virtual const std::vector< AnalysisName > & dependencyNames() const =0
AnalysisNames of all AnalysisResult dependencies.
virtual std::unique_ptr< AnalysisResult > result() &&=0
Transfers ownership of the built result.
Orchestrates whole-program analysis over an LUSummary.
Uniquely identifies a whole-program analysis and the AnalysisResult it produces.
Base class for whole-program analysis results.
Type-erased base for derived analyses.
Type-erased base for summary analyses.