Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:25

0001 //===-- NoopLattice.h -------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 //  This file defines the lattice with exactly one element.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_NOOP_LATTICE_H
0014 #define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_NOOP_LATTICE_H
0015 
0016 #include "clang/Analysis/FlowSensitive/DataflowLattice.h"
0017 #include "clang/Support/Compiler.h"
0018 #include "llvm/ADT/Any.h"
0019 #include <ostream>
0020 
0021 namespace clang {
0022 namespace dataflow {
0023 
0024 /// Trivial lattice for dataflow analysis with exactly one element.
0025 ///
0026 /// Useful for analyses that only need the Environment and nothing more.
0027 class NoopLattice {
0028 public:
0029   bool operator==(const NoopLattice &Other) const { return true; }
0030 
0031   LatticeJoinEffect join(const NoopLattice &Other) {
0032     return LatticeJoinEffect::Unchanged;
0033   }
0034 };
0035 
0036 inline std::ostream &operator<<(std::ostream &OS, const NoopLattice &) {
0037   return OS << "noop";
0038 }
0039 
0040 } // namespace dataflow
0041 } // namespace clang
0042 
0043 namespace llvm {
0044 // This needs to be exported for ClangAnalysisFlowSensitiveTests so any_cast
0045 // uses the correct address of Any::TypeId from the clang shared library instead
0046 // of creating one in the test executable. when building with
0047 // CLANG_LINK_CLANG_DYLIB
0048 extern template struct CLANG_TEMPLATE_ABI
0049     Any::TypeId<clang::dataflow::NoopLattice>;
0050 } // namespace llvm
0051 
0052 #endif // LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_NOOP_LATTICE_H