Skip to content

[StaticAnalyzer] Remove redundant calls to std::unique_ptr<T>::get (NFC) #139353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 "";
}
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/StaticAnalyzer/Core/SVals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down