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

Tamás Zolnai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 8 05:55:30 PST 2019


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 catches the cast, because the typedef information is
somehow lost by the dereferencing. Other use cases seem to be valid catches.

I had a closer look at some of the catches. Two of them were doing the same conversion what
an unsigned char conversion does. So there I replaced the old solution with a cast:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=85b5253492cd1c87cebc98d4c453812562a2f9ef

In other cases, the code is suspicious and surely would fail on non-ASCII characters, but
because of the context that does not happen. For example, a code which works with
font names never could get any special character, since font names are ASCII strings.

The output can be found here:
https://gist.github.com/tzolnai/c7e70d9bb51b78dd8a4036d209b19682


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71174/new/

https://reviews.llvm.org/D71174





More information about the cfe-commits mailing list