[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2020-01-01 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 235765. ztamas marked an inline comment as done. ztamas added a comment. Update docs / warning message, according to reviewer comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71174/new/ https://reviews.ll

[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2020-01-01 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas marked 2 inline comments as done. ztamas added inline comments. Comment at: clang-tools-extra/clang-tidy/bugprone/SignedCharMisuseCheck.cpp:97-98 + diag(CastExpression->getBeginLoc(), + "singed char -> integer (%0) conversion; " + "consider to cast to unsigne

[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2020-01-01 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 235790. ztamas added a comment. Update warning message in test files and rebase patch. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71174/new/ https://reviews.llvm.org/D71174 Files: clang-tools-extra/clang-t

[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2020-01-04 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added a comment. Thanks for the review! I applied for the renewal of my commit access. I had commit access only for the SVN repo. After I get access to the GitHub repo I'll push this change. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D7117

[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2020-01-06 Thread Tamás Zolnai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG350da402ef6b: [clang-tidy] new check: bugprone-signed-char-misuse (authored by ztamas). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71174/new/ https://rev

[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2020-01-12 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added a comment. In D71174#1815830 , @lebedev.ri wrote: > A little bit late to the party, but still. > I'm honestly wondering if this should be a proper clang static analyzer > data-flow aware check. > This is basically diagnosing every `signed c

[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2020-01-14 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added a comment. In D71174#1818883 , @sylvestre.ledru wrote: > In D71174#1774249 , @ztamas wrote: > > > I run the new check on LibreOffice codebase with the option > > CharTypdefsToIgnore = "sal_Int8". > >

[PATCH] D76990: [clang-tidy]: fix false positive of cert-oop54-cpp check.

2020-03-28 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas created this revision. Herald added subscribers: cfe-commits, xazax.hun. Herald added a project: clang. ztamas edited the summary of this revision. ztamas added a reviewer: aaron.ballman. It seems we need a different matcher for binary operator in a template context. Fixes this issue: http

[PATCH] D76990: [clang-tidy]: fix false positive of cert-oop54-cpp check.

2020-03-28 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 253354. ztamas added a comment. Run clang-format on test code. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76990/new/ https://reviews.llvm.org/D76990 Files: clang-tools-extra/clang-tidy/bugprone/UnhandledSe

[PATCH] D76990: [clang-tidy]: fix false positive of cert-oop54-cpp check.

2020-03-29 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 253412. ztamas added a comment. Rebase, TODO comment, remove unrelated change. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76990/new/ https://reviews.llvm.org/D76990 Files: clang-tools-extra/clang-tidy/bugp

[PATCH] D76990: [clang-tidy]: fix false positive of cert-oop54-cpp check.

2020-03-29 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added a comment. In D76990#1948286 , @njames93 wrote: > I'm not entirely sure this is where the fix needs to be for this. The test > case code is whacky as hell, but from what I can see clang should always emit > a `BinaryOperator` for dependent t

[PATCH] D76990: [clang-tidy]: fix false positive of cert-oop54-cpp check.

2020-03-29 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 253438. ztamas added a comment. Remove false TODO comment. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76990/new/ https://reviews.llvm.org/D76990 Files: clang-tools-extra/clang-tidy/bugprone/UnhandledSelfAs

[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2019-12-08 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas created this revision. Herald added subscribers: cfe-commits, xazax.hun, mgorny. Herald added a project: clang. This check searches for signed char -> integer conversions which might indicate programming error, because of the misinterpretation of char values. A signed char might store the n

[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2019-12-08 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added a comment. I run the new check on LibreOffice codebase with the option CharTypdefsToIgnore = "sal_Int8". The check produced 32 findings. I see 3 false positives which are similar to the DereferenceWithTypdef test case where the code uses sal_Int8 typedef, but the check still catche

[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2019-12-08 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added a comment. I run the new check on LLVM codebase with the option CharTypdefsToIgnore = "int8_t". The check produced 12 findings. All findings seem valid use cases, where a char -> integer conversion happens. I had a closer look at some of the catches. Somewhere I see only type misma

[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2019-12-09 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 232814. ztamas added a comment. Fixes small things mentioned by reviewer commments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71174/new/ https://reviews.llvm.org/D71174 Files: clang-tools-extra/clang-tidy

[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2019-12-09 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 232851. ztamas added a comment. Remove anonymus namespace Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71174/new/ https://reviews.llvm.org/D71174 Files: clang-tools-extra/clang-tidy/bugprone/BugproneTidyModu

[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2019-12-12 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 233638. ztamas added a comment. Update code based on reviewer comments. - Remove spurious semicolon. - Add tests about plain char. - Extend documentation describing how to control char signdness. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTI

[PATCH] D71174: [clang-tidy] new check: bugprone-signed-char-misuse

2019-12-12 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 233643. ztamas marked 2 inline comments as done. ztamas added a comment. Add newlines to the end of the files. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71174/new/ https://reviews.llvm.org/D71174 Files: c

[PATCH] D75749: [clang-tidy] extend bugprone-signed-char-misuse check.

2020-03-06 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas created this revision. Herald added subscribers: cfe-commits, xazax.hun. Herald added a project: clang. ztamas added a reviewer: aaron.ballman. ztamas added a comment. I run the check on LLVM code and found only one catch of suspicious comparison: clang-tidy -p=/home/zolnai/clang/build

[PATCH] D75749: [clang-tidy] extend bugprone-signed-char-misuse check.

2020-03-06 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added a comment. I run the check on LLVM code and found only one catch of suspicious comparison: clang-tidy -p=/home/zolnai/clang/build /home/zolnai/clang/llvm-project/clang/lib/Lex/Lexer.cpp /home/zolnai/clang/llvm-project/clang/lib/Lex/Lexer.cpp:1293:39: warning: comparison between

[PATCH] D75749: [clang-tidy] extend bugprone-signed-char-misuse check.

2020-03-06 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added a comment. In the LibreOffice codebase, I found 8 catches: https://gist.github.com/tzolnai/2b22492c0cf79f5dba577f6a878657e3 All catches seem valid to me. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75749/new/ https://reviews.llvm.or

[PATCH] D75749: [clang-tidy] extend bugprone-signed-char-misuse check.

2020-03-07 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 248908. ztamas added a comment. Changed code based on reviewer comments. - Removed unneeded allOf() - Remove unneeded ';' - Added new line at the end of the file - Moved variable declarations inside if() Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D75749: [clang-tidy] extend bugprone-signed-char-misuse check.

2020-03-07 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 248907. ztamas added a comment. Fix pre-merge check error Plus remove unneeded "no warning" comments and add a missing quote mark in docs. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75749/new/ https://review

[PATCH] D75749: [clang-tidy] extend bugprone-signed-char-misuse check.

2020-03-07 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 248909. ztamas added a comment. One more unneeded allOf and clang-format Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75749/new/ https://reviews.llvm.org/D75749 Files: clang-tools-extra/clang-tidy/bugprone/S

[PATCH] D75749: [clang-tidy] extend bugprone-signed-char-misuse check.

2020-03-07 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 248912. ztamas added a comment. Use quotes in warning message. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75749/new/ https://reviews.llvm.org/D75749 Files: clang-tools-extra/clang-tidy/bugprone/SignedCharM

[PATCH] D75749: [clang-tidy] extend bugprone-signed-char-misuse check.

2020-03-07 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas marked an inline comment as done. ztamas added inline comments. Comment at: clang-tools-extra/clang-tidy/bugprone/SignedCharMisuseCheck.cpp:97 + const auto CompareOperator = + expr(binaryOperator(anyOf(hasOperatorName("=="), hasOperatorName("!=")), +

[PATCH] D75749: [clang-tidy] extend bugprone-signed-char-misuse check.

2020-03-07 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 248917. ztamas added a comment. Update code based on reviewer comments. - Update docs: comparison -> equality/inequality comparison. - Use hasAnyOperatorName - Plus fix a typo Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews

[PATCH] D75749: [clang-tidy] extend bugprone-signed-char-misuse check.

2020-03-14 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added a comment. In D75749#1912338 , @njames93 wrote: > LGTM > > However, how does this handle cases when the type is written as `char`. They > can be signed/unsigned based on what platform is being targeted. But on a > platform where `char` is si

[PATCH] D75749: [clang-tidy] extend bugprone-signed-char-misuse check.

2020-03-14 Thread Tamás Zolnai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG04410c565aa0: [clang-tidy] extend bugprone-signed-char-misuse check. (authored by ztamas). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75749/new/ https://

<    1   2