llvm-project/clang-tools-extra/docs
Tamás Zolnai 350da402ef [clang-tidy] new check: bugprone-signed-char-misuse
Summary:
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 non-ASCII characters as negative
values. The human programmer probably expects that after an integer
conversion the converted value matches with the character code
(a value from [0..255]), however, the actual value is in
[-128..127] interval.

See also:
STR34-C. Cast characters to unsigned char before converting to larger integer sizes
<https://wiki.sei.cmu.edu/confluence/display/c/STR34-C.+Cast+characters+to+unsigned+char+before+converting+to+larger+integer+sizes>

By now this check is limited to assignment / variable declarations.
If we would catch all signed char -> integer conversion, then it would
produce a lot of findings and also false positives. So I added only
this use case now, but this check can be extended with additional
use cases later.
The CERT documentation mentions another use case when the char is
used for array subscript. Next to that a third use case can be
the signed char - unsigned char comparison, which also a use case
where things happen unexpectedly because of conversion to integer.

Reviewers: alexfh, hokein, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: sylvestre.ledru, whisperity, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits

Tags: #clang, #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D71174
2020-01-06 18:21:26 +01:00
..
_static Added more detailed documentation for clangd 2019-02-27 15:53:05 +00:00
_templates Added more detailed documentation for clangd 2019-02-27 15:53:05 +00:00
clang-tidy [clang-tidy] new check: bugprone-signed-char-misuse 2020-01-06 18:21:26 +01:00
clangd Fix some typos in the clang-tools-extra doc 2019-12-19 22:23:35 +01:00
CMakeLists.txt docs: Fix Sphinx detection with out-of-tree builds 2017-05-09 11:11:52 +00:00
ModularizeUsage.rst Remove trailing whitespace in docs and clang-tidy sources. 2016-12-13 16:38:45 +00:00
README.txt Updated the documentation build instructions for the current CMake build system 2019-02-25 13:03:44 +00:00
ReleaseNotes.rst [clang-tidy] new check: bugprone-signed-char-misuse 2020-01-06 18:21:26 +01:00
clang-doc.rst doc: Document that extra-arg/extra-arg-before can be used several times 2019-12-24 13:07:08 +01:00
clang-include-fixer.rst [docs] Update path to clang-tools-extra 2020-01-02 19:30:29 +08:00
clang-modernize.rst
clang-rename.rst doc: Document that extra-arg/extra-arg-before can be used several times 2019-12-24 13:07:08 +01:00
clang-tidy.rst [Documentation] Use HTTPS whenever possible. 2019-01-22 19:19:48 +00:00
clangd.rst [clangd] Redirect clangd page. 2019-03-08 09:56:42 +00:00
conf.py Bump the trunk version to 10.0.0svn 2019-07-18 11:51:05 +00:00
cpp11-migrate.rst
doxygen-mainpage.dox [docs] Fix docs to work with doxygen 1.8.11 2016-03-03 10:45:59 +00:00
doxygen.cfg.in Fix trivial typos in comments; NFC 2020-01-02 13:41:43 -05:00
index.rst Rename directory housing clang-include-fixer to be eponymous 2019-03-25 14:09:10 +00:00
make.bat
modularize.rst [Documentation] Use HTTPS whenever possible. 2019-01-22 19:19:48 +00:00
pp-trace.rst [docs] Update path to clang-tools-extra 2020-01-02 19:30:29 +08:00

README.txt

----------------------------------
Documentation in clang-tools-extra
----------------------------------

To generate documentation in HTML format from files in clang-tools-extra/docs,
build the docs-clang-tools-html target.

To generate documentation from the source code using Doxygen, build the
doxygen-clang-tools target.