samestep created this revision.
Herald added subscribers: martong, tschuett, mgrang, xazax.hun, mgorny.
Herald added a project: All.
samestep requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128448

Files:
  clang/docs/tools/clang-formatted-files.txt
  clang/include/clang/Analysis/FlowSensitive/SourceLocationsLattice.h
  clang/lib/Analysis/FlowSensitive/CMakeLists.txt
  clang/lib/Analysis/FlowSensitive/SourceLocationsLattice.cpp
  clang/unittests/Analysis/FlowSensitive/CMakeLists.txt
  clang/unittests/Analysis/FlowSensitive/SourceLocationsLatticeTest.cpp
  llvm/utils/gn/secondary/clang/lib/Analysis/FlowSensitive/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/Analysis/FlowSensitive/BUILD.gn

Index: llvm/utils/gn/secondary/clang/unittests/Analysis/FlowSensitive/BUILD.gn
===================================================================
--- llvm/utils/gn/secondary/clang/unittests/Analysis/FlowSensitive/BUILD.gn
+++ llvm/utils/gn/secondary/clang/unittests/Analysis/FlowSensitive/BUILD.gn
@@ -25,7 +25,6 @@
     "MultiVarConstantPropagationTest.cpp",
     "SingleVarConstantPropagationTest.cpp",
     "SolverTest.cpp",
-    "SourceLocationsLatticeTest.cpp",
     "TestingSupport.cpp",
     "TestingSupportTest.cpp",
     "TransferTest.cpp",
Index: llvm/utils/gn/secondary/clang/lib/Analysis/FlowSensitive/BUILD.gn
===================================================================
--- llvm/utils/gn/secondary/clang/lib/Analysis/FlowSensitive/BUILD.gn
+++ llvm/utils/gn/secondary/clang/lib/Analysis/FlowSensitive/BUILD.gn
@@ -9,7 +9,6 @@
     "ControlFlowContext.cpp",
     "DataflowAnalysisContext.cpp",
     "DataflowEnvironment.cpp",
-    "SourceLocationsLattice.cpp",
     "Transfer.cpp",
     "TypeErasedDataflowAnalysis.cpp",
     "WatchedLiteralsSolver.cpp",
Index: clang/unittests/Analysis/FlowSensitive/SourceLocationsLatticeTest.cpp
===================================================================
--- clang/unittests/Analysis/FlowSensitive/SourceLocationsLatticeTest.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//===- unittests/Analysis/FlowSensitive/SourceLocationsLatticeTest.cpp ----===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Analysis/FlowSensitive/SourceLocationsLattice.h"
-
-#include "clang/Analysis/FlowSensitive/DataflowLattice.h"
-#include "clang/Basic/SourceLocation.h"
-#include "gmock/gmock.h"
-#include "gtest/gtest.h"
-
-namespace clang {
-namespace dataflow {
-namespace {
-
-TEST(SourceLocationsLatticeTest, Comparison) {
-  const SourceLocationsLattice Bottom;
-  const SourceLocationsLattice NonBottom(
-      {SourceLocation::getFromRawEncoding(0)});
-
-  EXPECT_TRUE(Bottom == Bottom);
-  EXPECT_FALSE(Bottom == NonBottom);
-  EXPECT_FALSE(NonBottom == Bottom);
-  EXPECT_TRUE(NonBottom == NonBottom);
-
-  EXPECT_FALSE(Bottom != Bottom);
-  EXPECT_TRUE(Bottom != NonBottom);
-  EXPECT_TRUE(NonBottom != Bottom);
-  EXPECT_FALSE(NonBottom != NonBottom);
-}
-
-TEST(SourceLocationsLatticeTest, Join) {
-  const SourceLocationsLattice Bottom;
-  const SourceLocationsLattice NonBottom(
-      {SourceLocation::getFromRawEncoding(0)});
-  {
-    SourceLocationsLattice LHS = Bottom;
-    const SourceLocationsLattice RHS = Bottom;
-    EXPECT_EQ(LHS.join(RHS), LatticeJoinEffect::Unchanged);
-    EXPECT_EQ(LHS, Bottom);
-  }
-  {
-    SourceLocationsLattice LHS = NonBottom;
-    const SourceLocationsLattice RHS = Bottom;
-    EXPECT_EQ(LHS.join(RHS), LatticeJoinEffect::Unchanged);
-    EXPECT_EQ(LHS, NonBottom);
-  }
-  {
-    SourceLocationsLattice LHS = Bottom;
-    const SourceLocationsLattice RHS = NonBottom;
-    EXPECT_EQ(LHS.join(RHS), LatticeJoinEffect::Changed);
-    EXPECT_EQ(LHS, NonBottom);
-  }
-  {
-    SourceLocationsLattice LHS = NonBottom;
-    const SourceLocationsLattice RHS = NonBottom;
-    EXPECT_EQ(LHS.join(RHS), LatticeJoinEffect::Unchanged);
-    EXPECT_EQ(LHS, NonBottom);
-  }
-}
-
-} // namespace
-} // namespace dataflow
-} // namespace clang
Index: clang/unittests/Analysis/FlowSensitive/CMakeLists.txt
===================================================================
--- clang/unittests/Analysis/FlowSensitive/CMakeLists.txt
+++ clang/unittests/Analysis/FlowSensitive/CMakeLists.txt
@@ -11,7 +11,6 @@
   MatchSwitchTest.cpp
   MultiVarConstantPropagationTest.cpp
   SingleVarConstantPropagationTest.cpp
-  SourceLocationsLatticeTest.cpp
   TestingSupport.cpp
   TestingSupportTest.cpp
   TransferTest.cpp
Index: clang/lib/Analysis/FlowSensitive/SourceLocationsLattice.cpp
===================================================================
--- clang/lib/Analysis/FlowSensitive/SourceLocationsLattice.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-//===- SourceLocationsLattice.cpp -----------------------------------------===//
-//
-// 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 implements a lattice that collects source locations of interest.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Analysis/FlowSensitive/SourceLocationsLattice.h"
-#include "clang/AST/ASTContext.h"
-#include "clang/Analysis/FlowSensitive/DataflowLattice.h"
-#include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/Support/raw_ostream.h"
-#include <algorithm>
-#include <string>
-#include <vector>
-
-namespace clang {
-namespace dataflow {
-
-LatticeJoinEffect
-SourceLocationsLattice::join(const SourceLocationsLattice &Other) {
-  auto SizeBefore = Locs.size();
-  Locs.insert(Other.Locs.begin(), Other.Locs.end());
-  return SizeBefore == Locs.size() ? LatticeJoinEffect::Unchanged
-                                   : LatticeJoinEffect::Changed;
-}
-
-std::string DebugString(const llvm::DenseSet<SourceLocation> &Locs,
-                        const ASTContext &Context) {
-  if (Locs.empty())
-    return "";
-
-  std::vector<std::string> Locations;
-  Locations.reserve(Locs.size());
-  for (const clang::SourceLocation &Loc : Locs) {
-    Locations.push_back(Loc.printToString(Context.getSourceManager()));
-  }
-  std::sort(Locations.begin(), Locations.end());
-  std::string result;
-  llvm::raw_string_ostream OS(result);
-  llvm::interleaveComma(Locations, OS);
-  return result;
-}
-
-} // namespace dataflow
-} // namespace clang
Index: clang/lib/Analysis/FlowSensitive/CMakeLists.txt
===================================================================
--- clang/lib/Analysis/FlowSensitive/CMakeLists.txt
+++ clang/lib/Analysis/FlowSensitive/CMakeLists.txt
@@ -2,7 +2,6 @@
   ControlFlowContext.cpp
   DataflowAnalysisContext.cpp
   DataflowEnvironment.cpp
-  SourceLocationsLattice.cpp
   Transfer.cpp
   TypeErasedDataflowAnalysis.cpp
   WatchedLiteralsSolver.cpp
Index: clang/include/clang/Analysis/FlowSensitive/SourceLocationsLattice.h
===================================================================
--- clang/include/clang/Analysis/FlowSensitive/SourceLocationsLattice.h
+++ /dev/null
@@ -1,65 +0,0 @@
-//===-- SourceLocationsLattice.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 a lattice that collects source locations of interest.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_SOURCELOCATIONS_LATTICE_H
-#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_SOURCELOCATIONS_LATTICE_H
-
-#include "clang/AST/ASTContext.h"
-#include "clang/Analysis/FlowSensitive/DataflowLattice.h"
-#include "clang/Basic/SourceLocation.h"
-#include "llvm/ADT/DenseSet.h"
-#include <string>
-#include <utility>
-
-namespace clang {
-namespace dataflow {
-
-/// Lattice for dataflow analysis that keeps track of a set of source locations.
-///
-/// Bottom is the empty set, join is set union, and equality is set equality.
-///
-/// FIXME: Generalize into a (templated) PowerSetLattice.
-class SourceLocationsLattice {
-public:
-  SourceLocationsLattice() = default;
-
-  explicit SourceLocationsLattice(llvm::DenseSet<SourceLocation> Locs)
-      : Locs(std::move(Locs)) {}
-
-  bool operator==(const SourceLocationsLattice &Other) const {
-    return Locs == Other.Locs;
-  }
-
-  bool operator!=(const SourceLocationsLattice &Other) const {
-    return !(*this == Other);
-  }
-
-  LatticeJoinEffect join(const SourceLocationsLattice &Other);
-
-  llvm::DenseSet<SourceLocation> &getSourceLocations() { return Locs; }
-
-  const llvm::DenseSet<SourceLocation> &getSourceLocations() const {
-    return Locs;
-  }
-
-private:
-  llvm::DenseSet<SourceLocation> Locs;
-};
-
-/// Returns a string that represents the source locations.
-std::string DebugString(const llvm::DenseSet<SourceLocation> &Locs,
-                        const ASTContext &Context);
-
-} // namespace dataflow
-} // namespace clang
-
-#endif // LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_SOURCELOCATIONS_LATTICE_H
Index: clang/docs/tools/clang-formatted-files.txt
===================================================================
--- clang/docs/tools/clang-formatted-files.txt
+++ clang/docs/tools/clang-formatted-files.txt
@@ -134,7 +134,6 @@
 clang/include/clang/Analysis/FlowSensitive/MatchSwitch.h
 clang/include/clang/Analysis/FlowSensitive/NoopLattice.h
 clang/include/clang/Analysis/FlowSensitive/Solver.h
-clang/include/clang/Analysis/FlowSensitive/SourceLocationsLattice.h
 clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
 clang/include/clang/Analysis/FlowSensitive/Transfer.h
 clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h
@@ -311,7 +310,6 @@
 clang/lib/Analysis/FlowSensitive/ControlFlowContext.cpp
 clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
 clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
-clang/lib/Analysis/FlowSensitive/SourceLocationsLattice.cpp
 clang/lib/Analysis/FlowSensitive/Transfer.cpp
 clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
 clang/lib/Analysis/FlowSensitive/WatchedLiteralsSolver.cpp
@@ -638,7 +636,6 @@
 clang/unittests/Analysis/FlowSensitive/NoopAnalysis.h
 clang/unittests/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp
 clang/unittests/Analysis/FlowSensitive/SolverTest.cpp
-clang/unittests/Analysis/FlowSensitive/SourceLocationsLatticeTest.cpp
 clang/unittests/Analysis/FlowSensitive/TestingSupport.cpp
 clang/unittests/Analysis/FlowSensitive/TestingSupport.h
 clang/unittests/Analysis/FlowSensitive/TestingSupportTest.cpp
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to