PiotrZSL added inline comments.
Comment at: clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp:69
void StringConstructorCheck::registerMatchers(MatchFinder *Finder) {
+ const auto SignedCharType = qualType(isAnyCharacter(), isSignedInteger());
const auto ZeroEx
ccotter added a comment.
Thanks, fixed the first false positive example you gave. Let me think about the
second example in your most recent post:
char c = '\n';
using Size = int;
Size size = 10U;
std::string str2(c, size);
This is my newly added case `swapped4`, where one of my original
ccotter updated this revision to Diff 530349.
ccotter added a comment.
- Exclude false positive
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143971/new/
https://reviews.llvm.org/D143971
Files:
clang-tools-extra/clang-tidy/bugprone/StringConstru
PiotrZSL requested changes to this revision.
PiotrZSL added a comment.
This revision now requires changes to proceed.
I run into false positive with this example:
using UInt8 = unsigned char;
UInt8 size = 5U;
std::string str2(size, 'x'); // warning: string constructor arguments are
proba
ccotter added a comment.
bump please?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143971/new/
https://reviews.llvm.org/D143971
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm
ccotter added a comment.
bump please?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143971/new/
https://reviews.llvm.org/D143971
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm
ccotter updated this revision to Diff 520143.
ccotter added a comment.
rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143971/new/
https://reviews.llvm.org/D143971
Files:
clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
cl
ccotter updated this revision to Diff 509541.
ccotter added a comment.
rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143971/new/
https://reviews.llvm.org/D143971
Files:
clang-tools-extra/clang-tidy/modernize/AvoidCArraysCheck.cpp
clang-
ccotter marked an inline comment as done.
ccotter added inline comments.
Comment at:
clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp:70-74
+ const auto CharExpr = expr(anyOf(
+ ignoringParenImpCasts(characterLiteral()),
+
declRefExpr(hasDeclaration(v
ccotter updated this revision to Diff 508345.
ccotter marked 4 inline comments as done.
ccotter added a comment.
- Add more cases to swapped params
- Change message, add more tests
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143971/new/
https://r
carlosgalvezp added inline comments.
Comment at:
clang-tools-extra/docs/clang-tidy/checks/bugprone/string-constructor.rst:25
+ std::string str(buf[1], 5); // First arg should be '&buf[1]'?
+ std::string str2((int)buf[1], 5); // Ok - explicitly cast to express intent
PiotrZSL added inline comments.
Comment at: clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp:97
+ const auto CharToIntCastExpr = implicitCastExpr(
+ hasSourceExpression(expr(hasType(qualType(isAnyCharacter(),
+ hasImplicitDestinationType(NonCharacte
PiotrZSL added inline comments.
Comment at:
clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp:70-74
+ const auto CharExpr = expr(anyOf(
+ ignoringParenImpCasts(characterLiteral()),
+
declRefExpr(hasDeclaration(varDecl(hasType(qualType(isAnyCharacter())
ccotter updated this revision to Diff 500645.
ccotter added a comment.
- Add more cases to swapped params
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143971/new/
https://reviews.llvm.org/D143971
Files:
clang-tools-extra/clang-tidy/bugprone/Str
14 matches
Mail list logo