Skip to content

Commit

Permalink
[analyzer][NFC] Take StringRef by value
Browse files Browse the repository at this point in the history
  • Loading branch information
steakhal committed Jan 1, 2024
1 parent 9926619 commit 7619050
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions clang/lib/StaticAnalyzer/Checkers/IteratorRangeChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class IteratorRangeChecker
void verifyAdvance(CheckerContext &C, SVal LHS, SVal RHS) const;
void verifyPrev(CheckerContext &C, SVal LHS, SVal RHS) const;
void verifyNext(CheckerContext &C, SVal LHS, SVal RHS) const;
void reportBug(const StringRef &Message, SVal Val, CheckerContext &C,
void reportBug(StringRef Message, SVal Val, CheckerContext &C,
ExplodedNode *ErrNode) const;

public:
Expand Down Expand Up @@ -269,7 +269,7 @@ void IteratorRangeChecker::verifyNext(CheckerContext &C, SVal LHS,
verifyRandomIncrOrDecr(C, OO_Plus, LHS, RHS);
}

void IteratorRangeChecker::reportBug(const StringRef &Message, SVal Val,
void IteratorRangeChecker::reportBug(StringRef Message, SVal Val,
CheckerContext &C,
ExplodedNode *ErrNode) const {
auto R = std::make_unique<PathSensitiveBugReport>(OutOfRangeBugType, Message,
Expand Down
20 changes: 8 additions & 12 deletions clang/lib/StaticAnalyzer/Checkers/MismatchedIteratorChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ class MismatchedIteratorChecker
const MemRegion *Cont) const;
void verifyMatch(CheckerContext &C, const SVal &Iter1,
const SVal &Iter2) const;
void reportBug(const StringRef &Message, const SVal &Val1,
const SVal &Val2, CheckerContext &C,
ExplodedNode *ErrNode) const;
void reportBug(const StringRef &Message, const SVal &Val,
const MemRegion *Reg, CheckerContext &C,
ExplodedNode *ErrNode) const;
void reportBug(StringRef Message, const SVal &Val1, const SVal &Val2,
CheckerContext &C, ExplodedNode *ErrNode) const;
void reportBug(StringRef Message, const SVal &Val, const MemRegion *Reg,
CheckerContext &C, ExplodedNode *ErrNode) const;

public:
void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
Expand Down Expand Up @@ -271,10 +269,8 @@ void MismatchedIteratorChecker::verifyMatch(CheckerContext &C,
}
}

void MismatchedIteratorChecker::reportBug(const StringRef &Message,
const SVal &Val1,
const SVal &Val2,
CheckerContext &C,
void MismatchedIteratorChecker::reportBug(StringRef Message, const SVal &Val1,
const SVal &Val2, CheckerContext &C,
ExplodedNode *ErrNode) const {
auto R = std::make_unique<PathSensitiveBugReport>(MismatchedBugType, Message,
ErrNode);
Expand All @@ -283,8 +279,8 @@ void MismatchedIteratorChecker::reportBug(const StringRef &Message,
C.emitReport(std::move(R));
}

void MismatchedIteratorChecker::reportBug(const StringRef &Message,
const SVal &Val, const MemRegion *Reg,
void MismatchedIteratorChecker::reportBug(StringRef Message, const SVal &Val,
const MemRegion *Reg,
CheckerContext &C,
ExplodedNode *ErrNode) const {
auto R = std::make_unique<PathSensitiveBugReport>(MismatchedBugType, Message,
Expand Down

0 comments on commit 7619050

Please sign in to comment.