1//===-- NoopLattice.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 the lattice with exactly one element.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_NOOP_LATTICE_H
14#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_NOOP_LATTICE_H
15
16#include "clang/Analysis/FlowSensitive/DataflowLattice.h"
17#include <ostream>
18
19namespace clang {
20namespace dataflow {
21
22/// Trivial lattice for dataflow analysis with exactly one element.
23///
24/// Useful for analyses that only need the Environment and nothing more.
25class NoopLattice {
26public:
27 bool operator==(const NoopLattice &Other) const { return true; }
28
29 LatticeJoinEffect join(const NoopLattice &Other) {
30 return LatticeJoinEffect::Unchanged;
31 }
32};
33
34inline std::ostream &operator<<(std::ostream &OS, const NoopLattice &) {
35 return OS << "noop";
36}
37
38} // namespace dataflow
39} // namespace clang
40
41#endif // LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_NOOP_LATTICE_H
42

source code of clang/include/clang/Analysis/FlowSensitive/NoopLattice.h