clang  16.0.0git
NoopAnalysis.h
Go to the documentation of this file.
1 //===-- NoopAnalysis.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 // This file defines a NoopAnalysis class that just uses the builtin transfer.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_NOOPANALYSIS_H
14 #define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_NOOPANALYSIS_H
15 
16 #include "clang/AST/ASTContext.h"
17 #include "clang/Analysis/CFG.h"
21 
22 namespace clang {
23 namespace dataflow {
24 
25 class NoopAnalysis : public DataflowAnalysis<NoopAnalysis, NoopLattice> {
26 public:
27  /// Deprecated. Use the `DataflowAnalysisOptions` constructor instead.
28  NoopAnalysis(ASTContext &Context, bool ApplyBuiltinTransfer)
30  ApplyBuiltinTransfer) {}
31 
32  /// `ApplyBuiltinTransfer` controls whether to run the built-in transfer
33  /// functions that model memory during the analysis. Their results are not
34  /// used by `NoopAnalysis`, but tests that need to inspect the environment
35  /// should enable them.
37  : DataflowAnalysis<NoopAnalysis, NoopLattice>(Context, Options) {}
38 
39  static NoopLattice initialElement() { return {}; }
40 
41  void transfer(const CFGElement *E, NoopLattice &L, Environment &Env) {}
42 };
43 
44 } // namespace dataflow
45 } // namespace clang
46 
47 #endif // LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_NOOPANALYSIS_H
clang::dataflow::DataflowAnalysisOptions
Definition: TypeErasedDataflowAnalysis.h:34
clang::dataflow::NoopAnalysis
Definition: NoopAnalysis.h:25
clang::dataflow::DataflowAnalysis
Base class template for dataflow analyses built on a single lattice type.
Definition: DataflowAnalysis.h:76
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:209
ASTContext.h
clang::dataflow::NoopAnalysis::initialElement
static NoopLattice initialElement()
Definition: NoopAnalysis.h:39
clang::dataflow::NoopAnalysis::transfer
void transfer(const CFGElement *E, NoopLattice &L, Environment &Env)
Definition: NoopAnalysis.h:41
NoopLattice.h
clang::dataflow::NoopAnalysis::NoopAnalysis
NoopAnalysis(ASTContext &Context, DataflowAnalysisOptions Options)
ApplyBuiltinTransfer controls whether to run the built-in transfer functions that model memory during...
Definition: NoopAnalysis.h:36
DataflowEnvironment.h
clang::dataflow::NoopLattice
Trivial lattice for dataflow analysis with exactly one element.
Definition: NoopLattice.h:25
clang::CFGElement
Represents a top-level expression in a basic block.
Definition: CFG.h:55
clang
Definition: CalledOnceCheck.h:17
CFG.h
clang::dataflow::NoopAnalysis::NoopAnalysis
NoopAnalysis(ASTContext &Context, bool ApplyBuiltinTransfer)
Deprecated. Use the DataflowAnalysisOptions constructor instead.
Definition: NoopAnalysis.h:28
clang::dataflow::Environment
Holds the state of the program (store and heap) at a given program point.
Definition: DataflowEnvironment.h:65
DataflowAnalysis.h