Skip to content

Commit 47c1601

Browse files
Rename ensureSizeZeroIfLineNull
1 parent ab31dbc commit 47c1601

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,9 @@ class StreamChecker : public Checker<check::PreCall, eval::Call,
529529
ProgramStateRef ensurePtrNotNull(SVal PtrVal, const Expr *PtrExpr,
530530
CheckerContext &C, ProgramStateRef State,
531531
const StringRef PtrDescr) const;
532-
ProgramStateRef
533-
ensureSizeZeroIfLineNull(SVal LinePtrPtrSVal, SVal SizePtrSVal,
534-
const Expr *LinePtrPtrExpr, const Expr *SizePtrExpr,
535-
CheckerContext &C, ProgramStateRef State) const;
532+
ProgramStateRef ensureGetdelimBufferAndSizeCorrect(
533+
SVal LinePtrPtrSVal, SVal SizePtrSVal, const Expr *LinePtrPtrExpr,
534+
const Expr *SizePtrExpr, CheckerContext &C, ProgramStateRef State) const;
536535

537536
/// Generate warning about stream in EOF state.
538537
/// There will be always a state transition into the passed State,
@@ -1218,7 +1217,7 @@ StreamChecker::ensurePtrNotNull(SVal PtrVal, const Expr *PtrExpr,
12181217
return PtrNotNull;
12191218
}
12201219

1221-
ProgramStateRef StreamChecker::ensureSizeZeroIfLineNull(
1220+
ProgramStateRef StreamChecker::ensureGetdelimBufferAndSizeCorrect(
12221221
SVal LinePtrPtrSVal, SVal SizePtrSVal, const Expr *LinePtrPtrExpr,
12231222
const Expr *SizePtrExpr, CheckerContext &C, ProgramStateRef State) const {
12241223
static constexpr char SizeNotZeroMsg[] =
@@ -1291,10 +1290,9 @@ void StreamChecker::preGetdelim(const FnDescription *Desc,
12911290
if (!State)
12921291
return;
12931292

1294-
// If `lineptr` points to a NULL pointer, `*n` must be 0.
1295-
State =
1296-
ensureSizeZeroIfLineNull(LinePtrPtrSVal, SizePtrSval, Call.getArgExpr(0),
1297-
Call.getArgExpr(1), C, State);
1293+
State = ensureGetdelimBufferAndSizeCorrect(LinePtrPtrSVal, SizePtrSval,
1294+
Call.getArgExpr(0),
1295+
Call.getArgExpr(1), C, State);
12981296
if (!State)
12991297
return;
13001298

0 commit comments

Comments
 (0)