File tree Expand file tree Collapse file tree 4 files changed +7
-14
lines changed Expand file tree Collapse file tree 4 files changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -307,10 +307,9 @@ static void lengthExprHandle(const Expr *LengthExpr,
307307 // Try to obtain an 'IntegerLiteral' and adjust it.
308308 if (!IsMacroDefinition) {
309309 if (const auto *LengthIL = dyn_cast<IntegerLiteral>(LengthExpr)) {
310- size_t NewLength = LengthIL->getValue ().getZExtValue () +
311- (LengthHandle == LengthHandleKind::Increase
312- ? (isInjectUL (Result) ? 1UL : 1 )
313- : -1 );
310+ uint64_t NewLength =
311+ LengthIL->getValue ().getZExtValue () +
312+ (LengthHandle == LengthHandleKind::Increase ? 1 : -1 );
314313
315314 const auto NewLengthFix = FixItHint::CreateReplacement (
316315 LengthIL->getSourceRange (),
Original file line number Diff line number Diff line change @@ -274,6 +274,10 @@ Changes in existing checks
274274 <clang-tidy/checks/bugprone/narrowing-conversions>` check by fixing
275275 false positive from analysis of a conditional expression in C.
276276
277+ - Improved :doc: `bugprone-not-null-terminated-result
278+ <clang-tidy/checks/bugprone/not-null-terminated-result>` check by fixing
279+ bogus fix-its for `strncmp ` and `wcsncmp ` on Windows.
280+
277281- Improved :doc: `bugprone-reserved-identifier
278282 <clang-tidy/checks/bugprone/reserved-identifier>` check by ignoring
279283 declarations and macros in system headers.
Original file line number Diff line number Diff line change 11// RUN: %check_clang_tidy --match-partial-fixes %s bugprone-not-null-terminated-result %t -- \
22// RUN: -- -I %S/Inputs/not-null-terminated-result
33
4- // FIXME: Something wrong with the APInt un/signed conversion on Windows:
5- // in 'strncmp(str6, "string", 7);' it tries to inject '4294967302' as length.
6-
7- // UNSUPPORTED: system-windows
8-
94#include "not-null-terminated-result-c.h"
105
116#define __STDC_LIB_EXT1__ 1
Original file line number Diff line number Diff line change 11// RUN: %check_clang_tidy --match-partial-fixes %s bugprone-not-null-terminated-result %t -- \
22// RUN: -- -std=c++11 -I %S/Inputs/not-null-terminated-result
33
4- // FIXME: Something wrong with the APInt un/signed conversion on Windows:
5- // in 'wcsncmp(wcs6, L"string", 7);' it tries to inject '4294967302' as length.
6-
7- // UNSUPPORTED: system-windows
8-
94#include " not-null-terminated-result-cxx.h"
105
116#define __STDC_LIB_EXT1__ 1
You can’t perform that action at this time.
0 commit comments