Skip to content

Commit 976cf7c

Browse files
Feedback from review
1 parent 36e36ba commit 976cf7c

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,16 +1198,15 @@ void StreamChecker::evalUngetc(const FnDescription *Desc, const CallEvent &Call,
11981198
ProgramStateRef StreamChecker::ensureGetdelimBufferAndSizeCorrect(
11991199
SVal LinePtrPtrSVal, SVal SizePtrSVal, const Expr *LinePtrPtrExpr,
12001200
const Expr *SizePtrExpr, CheckerContext &C, ProgramStateRef State) const {
1201-
static constexpr char SizeGreaterThanBufferSize[] =
1201+
static constexpr llvm::StringLiteral SizeGreaterThanBufferSize =
12021202
"The buffer from the first argument is smaller than the size "
12031203
"specified by the second parameter";
1204-
static constexpr char SizeUndef[] =
1204+
static constexpr llvm::StringLiteral SizeUndef =
12051205
"The buffer from the first argument is not NULL, but the size specified "
12061206
"by the second parameter is undefined.";
12071207

1208-
auto EmitBugReport = [this, &C, SizePtrExpr,
1209-
LinePtrPtrExpr](const ProgramStateRef &BugState,
1210-
const char *ErrMsg) {
1208+
auto EmitBugReport = [this, &C, SizePtrExpr, LinePtrPtrExpr](
1209+
ProgramStateRef BugState, StringRef ErrMsg) {
12111210
if (ExplodedNode *N = C.generateErrorNode(BugState)) {
12121211
auto R =
12131212
std::make_unique<PathSensitiveBugReport>(BT_IllegalSize, ErrMsg, N);
@@ -1243,12 +1242,10 @@ ProgramStateRef StreamChecker::ensureGetdelimBufferAndSizeCorrect(
12431242
auto LineBufSizeGtN = SVB.evalBinOp(LinePtrNotNull, BO_GE, LineBufSize,
12441243
*NDefSVal, SVB.getConditionType())
12451244
.getAs<DefinedOrUnknownSVal>();
1246-
if (!LineBufSizeGtN) {
1245+
if (!LineBufSizeGtN)
12471246
return LinePtrNotNull;
1248-
}
1249-
if (auto LineBufSizeOk = LinePtrNotNull->assume(*LineBufSizeGtN, true)) {
1247+
if (auto LineBufSizeOk = LinePtrNotNull->assume(*LineBufSizeGtN, true))
12501248
return LineBufSizeOk;
1251-
}
12521249

12531250
EmitBugReport(LinePtrNotNull, SizeGreaterThanBufferSize);
12541251
return nullptr;

0 commit comments

Comments
 (0)