Index: clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp =================================================================== --- clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp +++ clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp @@ -27,10 +27,15 @@ callee(cxxMethodDecl(ofClass(classTemplateSpecializationDecl( hasName("::std::basic_string"), hasTemplateArgument(0, refersToType(qualType().bind("type"))))))), - hasArgument(1, - ignoringImpCasts(expr(hasType(isInteger()), - unless(hasType(isAnyCharacter()))) - .bind("expr"))), + hasArgument( + 1, + ignoringImpCasts( + expr(hasType(isInteger()), unless(hasType(isAnyCharacter())), + // Ignore calls to tolower/toupper (see PR27723). + unless(callExpr(callee(functionDecl( + hasAnyName("tolower", "std::tolower", "toupper", + "std::toupper")))))) + .bind("expr"))), unless(isInTemplateInstantiation())), this); } Index: test/clang-tidy/bugprone-string-integer-assignment.cpp =================================================================== --- test/clang-tidy/bugprone-string-integer-assignment.cpp +++ test/clang-tidy/bugprone-string-integer-assignment.cpp @@ -11,8 +11,14 @@ typedef basic_string string; typedef basic_string wstring; + +int tolower(int i); +int toupper(int i); } +int tolower(int i); +int toupper(int i); + typedef int MyArcaneChar; int main() { @@ -50,4 +56,7 @@ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: an integer is interpreted as a chara // CHECK-FIXES: {{^}} as = 6;{{$}} + s += toupper(x); + s += tolower(x); + s += std::tolower(x); }