-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang][dataflow] Use NoopLattice in optional model
Followup to D128352. This patch pulls the `NoopLattice` class out from the `NoopAnalysis.h` test file into its own `NoopLattice.h` source file, and uses it to replace usage of `SourceLocationsLattice` in `UncheckedOptionalAccessModel`. Reviewed By: ymandel, sgatev, gribozavr2, xazax.hun Differential Revision: https://reviews.llvm.org/D128356
- Loading branch information
Showing
5 changed files
with
53 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//===-- NoopLattice.h -------------------------------------------*- 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 file defines the lattice with exactly one element. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_NOOP_LATTICE_H | ||
#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_NOOP_LATTICE_H | ||
|
||
#include "clang/Analysis/FlowSensitive/DataflowLattice.h" | ||
#include <ostream> | ||
|
||
namespace clang { | ||
namespace dataflow { | ||
|
||
/// Trivial lattice for dataflow analysis with exactly one element. | ||
/// | ||
/// Useful for analyses that only need the Environment and nothing more. | ||
class NoopLattice { | ||
public: | ||
bool operator==(const NoopLattice &Other) const { return true; } | ||
|
||
LatticeJoinEffect join(const NoopLattice &Other) { | ||
return LatticeJoinEffect::Unchanged; | ||
} | ||
}; | ||
|
||
inline std::ostream &operator<<(std::ostream &OS, const NoopLattice &) { | ||
return OS << "noop"; | ||
} | ||
|
||
} // namespace dataflow | ||
} // namespace clang | ||
|
||
#endif // LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_NOOP_LATTICE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters