1// RUN: %check_clang_tidy %s bugprone-signed-char-misuse %t -- -- -funsigned-char
2
3// Test framework needs something to catch, otherwise it fails.
4int SignedChar() {
5 signed char CCharacter = -5;
6 int NCharacter;
7 NCharacter = CCharacter;
8 // CHECK-MESSAGES: [[@LINE-1]]:16: warning: 'signed char' to 'int' conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse]
9
10 return NCharacter;
11}
12
13int PlainChar() {
14 char CCharacter = -5;
15 int NCharacter = CCharacter; // no warning
16 return NCharacter;
17}
18

source code of clang-tools-extra/test/clang-tidy/checkers/bugprone/signed-char-misuse-funsigned-char.cpp