[PATCH] D29839: [clang-tidy] New misc-istream-overflow check
Piotr Padlewski via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 10 11:55:23 PST 2017
Prazek added a comment.
Nice check! :)
================
Comment at: clang-tidy/misc/IstreamOverflowCheck.cpp:59-61
+ if (ConstType) {
+ ArraySize = ConstType->getSize();
+ }
----------------
same here
================
Comment at: clang-tidy/misc/IstreamOverflowCheck.cpp:78-80
+ if (!Arg->isIntegerConstantExpr(WidthSize, Context)) {
+ llvm::errs() << "Couldn't get width() size.\n";
+ }
----------------
debug?
================
Comment at: clang-tidy/misc/IstreamOverflowCheck.cpp:111-116
+ if (HasWidthCall && WidthSize != 0) {
+ Width = WidthSize;
+ }
+ if (HasSetwCall && SetwSize != 0) {
+ Width = SetwSize;
+ }
----------------
please remove unnecessary braces
================
Comment at: clang-tidy/misc/IstreamOverflowCheck.cpp:125-132
+ if (HasSetwCall) {
+ diag(SetwCall->getLocation(), "std::setw called here",
+ DiagnosticIDs::Note);
+ }
+ if (HasWidthCall) {
+ diag(WidthCall->getExprLoc(), "width called here",
+ DiagnosticIDs::Note);
----------------
same here
Repository:
rL LLVM
https://reviews.llvm.org/D29839
More information about the cfe-commits
mailing list