Skip to content

Commit c15967f

Browse files
committed
Address the review comment. Namely avoid calling getTypePtrOrNull and don't use raw_svector_ostream.
1 parent 6f94c58 commit c15967f

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class UncountedCallArgsChecker
7272

7373
if (auto *MemberCallExpr = dyn_cast<CXXMemberCallExpr>(CE)) {
7474
auto *E = MemberCallExpr->getImplicitObjectArgument();
75-
auto *ArgType = MemberCallExpr->getObjectType().getTypePtrOrNull();
75+
QualType ArgType = MemberCallExpr->getObjectType();
7676
std::optional<bool> IsUncounted =
7777
isUncounted(ArgType->getAsCXXRecordDecl());
7878
if (IsUncounted && *IsUncounted && !isPtrOriginSafe(E))
@@ -213,15 +213,10 @@ class UncountedCallArgsChecker
213213
void reportBugOnThis(const Expr *CallArg) const {
214214
assert(CallArg);
215215

216-
SmallString<100> Buf;
217-
llvm::raw_svector_ostream Os(Buf);
218-
219-
Os << "Call argument for 'this' parameter is uncounted and unsafe.";
220-
221216
const SourceLocation SrcLocToReport = CallArg->getSourceRange().getBegin();
222217

223218
PathDiagnosticLocation BSLoc(SrcLocToReport, BR->getSourceManager());
224-
auto Report = std::make_unique<BasicBugReport>(Bug, Os.str(), BSLoc);
219+
auto Report = std::make_unique<BasicBugReport>(Bug, "Call argument for 'this' parameter is uncounted and unsafe.", BSLoc);
225220
Report->addRange(CallArg->getSourceRange());
226221
BR->emitReport(std::move(Report));
227222
}

0 commit comments

Comments
 (0)