Skip to content

Commit abedb5e

Browse files
[StaticAnalyzer] Remove redundant calls to std::unique_ptr<T>::get (NFC) (#139353)
1 parent 6e4f501 commit abedb5e

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ bool PlacementNewChecker::checkPlaceCapacityIsSufficient(
124124
"requires {1} bytes. Current overhead requires the size of {2} "
125125
"bytes",
126126
SizeOfPlaceCI->getValue(), SizeOfTargetCI->getValue(),
127-
*SizeOfPlaceCI->getValue().get() - SizeOfTargetCI->getValue()));
127+
*SizeOfPlaceCI->getValue() - SizeOfTargetCI->getValue()));
128128
else if (IsArrayTypeAllocated &&
129129
SizeOfPlaceCI->getValue() == SizeOfTargetCI->getValue())
130130
Msg = std::string(llvm::formatv(

clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ class DeadStoreObs : public LiveVariables::Observer {
157157
return true;
158158
// Lazily construct the set that records which VarDecls are in
159159
// EH code.
160-
if (!InEH.get()) {
160+
if (!InEH) {
161161
InEH.reset(new llvm::DenseSet<const VarDecl *>());
162-
EHCodeVisitor V(*InEH.get());
162+
EHCodeVisitor V(*InEH);
163163
V.TraverseStmt(AC->getBody());
164164
}
165165
// Treat all VarDecls that occur in EH code as being "always live"
@@ -196,7 +196,7 @@ class DeadStoreObs : public LiveVariables::Observer {
196196

197197
// Compute reachable blocks within the CFG for trivial cases
198198
// where a bogus dead store can be reported because itself is unreachable.
199-
if (!reachableCode.get()) {
199+
if (!reachableCode) {
200200
reachableCode.reset(new ReachableCode(cfg));
201201
reachableCode->computeReachableBlocks();
202202
}

clang/lib/StaticAnalyzer/Core/ExprEngine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4050,7 +4050,7 @@ std::string ExprEngine::DumpGraph(ArrayRef<const ExplodedNode *> Nodes,
40504050
StringRef Filename) {
40514051
std::unique_ptr<ExplodedGraph> TrimmedG(G.trim(Nodes));
40524052

4053-
if (!TrimmedG.get()) {
4053+
if (!TrimmedG) {
40544054
llvm::errs() << "warning: Trimmed ExplodedGraph is empty.\n";
40554055
return "";
40564056
}

clang/lib/StaticAnalyzer/Core/SVals.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,9 @@ bool SVal::isConstant() const {
249249

250250
bool SVal::isConstant(int I) const {
251251
if (std::optional<loc::ConcreteInt> LV = getAs<loc::ConcreteInt>())
252-
return *LV->getValue().get() == I;
252+
return *LV->getValue() == I;
253253
if (std::optional<nonloc::ConcreteInt> NV = getAs<nonloc::ConcreteInt>())
254-
return *NV->getValue().get() == I;
254+
return *NV->getValue() == I;
255255
return false;
256256
}
257257

clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ ProgramStateRef SimpleConstraintManager::assumeAux(ProgramStateRef State,
7575
}
7676

7777
case nonloc::ConcreteIntKind: {
78-
bool b = *Cond.castAs<nonloc::ConcreteInt>().getValue().get() != 0;
78+
bool b = *Cond.castAs<nonloc::ConcreteInt>().getValue() != 0;
7979
bool isFeasible = b ? Assumption : !Assumption;
8080
return isFeasible ? State : nullptr;
8181
}

0 commit comments

Comments
 (0)