https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/139353

None

>From b2e1ad4dde2e1a2ef56e47d7c86e86271c264521 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <k...@google.com>
Date: Tue, 25 Mar 2025 00:24:37 -0700
Subject: [PATCH] [StaticAnalyzer] Remove redundant calls to
 std::unique_ptr<T>::get (NFC)

---
 clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp   | 2 +-
 clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp   | 6 +++---
 clang/lib/StaticAnalyzer/Core/ExprEngine.cpp              | 2 +-
 clang/lib/StaticAnalyzer/Core/SVals.cpp                   | 4 ++--
 clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp 
b/clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp
index 3a66b0f11eb2e..839c8bcd90210 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp
@@ -124,7 +124,7 @@ bool PlacementNewChecker::checkPlaceCapacityIsSufficient(
             "requires {1} bytes. Current overhead requires the size of {2} "
             "bytes",
             SizeOfPlaceCI->getValue(), SizeOfTargetCI->getValue(),
-            *SizeOfPlaceCI->getValue().get() - SizeOfTargetCI->getValue()));
+            *SizeOfPlaceCI->getValue() - SizeOfTargetCI->getValue()));
       else if (IsArrayTypeAllocated &&
                SizeOfPlaceCI->getValue() == SizeOfTargetCI->getValue())
         Msg = std::string(llvm::formatv(
diff --git a/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
index 4e3919ef01667..637cf87ef8b6d 100644
--- a/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
@@ -157,9 +157,9 @@ class DeadStoreObs : public LiveVariables::Observer {
       return true;
     // Lazily construct the set that records which VarDecls are in
     // EH code.
-    if (!InEH.get()) {
+    if (!InEH) {
       InEH.reset(new llvm::DenseSet<const VarDecl *>());
-      EHCodeVisitor V(*InEH.get());
+      EHCodeVisitor V(*InEH);
       V.TraverseStmt(AC->getBody());
     }
     // Treat all VarDecls that occur in EH code as being "always live"
@@ -196,7 +196,7 @@ class DeadStoreObs : public LiveVariables::Observer {
 
     // Compute reachable blocks within the CFG for trivial cases
     // where a bogus dead store can be reported because itself is unreachable.
-    if (!reachableCode.get()) {
+    if (!reachableCode) {
       reachableCode.reset(new ReachableCode(cfg));
       reachableCode->computeReachableBlocks();
     }
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp 
b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 86e2e8f634bfd..40514cb1ba449 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -4050,7 +4050,7 @@ std::string ExprEngine::DumpGraph(ArrayRef<const 
ExplodedNode *> Nodes,
                                   StringRef Filename) {
   std::unique_ptr<ExplodedGraph> TrimmedG(G.trim(Nodes));
 
-  if (!TrimmedG.get()) {
+  if (!TrimmedG) {
     llvm::errs() << "warning: Trimmed ExplodedGraph is empty.\n";
     return "";
   }
diff --git a/clang/lib/StaticAnalyzer/Core/SVals.cpp 
b/clang/lib/StaticAnalyzer/Core/SVals.cpp
index 3ab01a04dcec4..824e4a3630735 100644
--- a/clang/lib/StaticAnalyzer/Core/SVals.cpp
+++ b/clang/lib/StaticAnalyzer/Core/SVals.cpp
@@ -249,9 +249,9 @@ bool SVal::isConstant() const {
 
 bool SVal::isConstant(int I) const {
   if (std::optional<loc::ConcreteInt> LV = getAs<loc::ConcreteInt>())
-    return *LV->getValue().get() == I;
+    return *LV->getValue() == I;
   if (std::optional<nonloc::ConcreteInt> NV = getAs<nonloc::ConcreteInt>())
-    return *NV->getValue().get() == I;
+    return *NV->getValue() == I;
   return false;
 }
 
diff --git a/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp 
b/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
index 3c5c992fa8dbc..ee9f90796fead 100644
--- a/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
+++ b/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
@@ -75,7 +75,7 @@ ProgramStateRef 
SimpleConstraintManager::assumeAux(ProgramStateRef State,
   }
 
   case nonloc::ConcreteIntKind: {
-    bool b = *Cond.castAs<nonloc::ConcreteInt>().getValue().get() != 0;
+    bool b = *Cond.castAs<nonloc::ConcreteInt>().getValue() != 0;
     bool isFeasible = b ? Assumption : !Assumption;
     return isFeasible ? State : nullptr;
   }

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to