Grillo updated this revision to Diff 469571. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136355/new/
https://reviews.llvm.org/D136355 Files: clang/docs/ReleaseNotes.rst clang/lib/Sema/SemaChecking.cpp clang/test/Sema/non-null-warning.c Index: clang/test/Sema/non-null-warning.c =================================================================== --- clang/test/Sema/non-null-warning.c +++ clang/test/Sema/non-null-warning.c @@ -37,9 +37,16 @@ return 0; // expected-warning {{null returned from function that requires a non-null return value}} } +int foo4(int * _Nonnull x, int * y) { + return 0; +} + #define SAFE_CALL(X) if (X) foo(X) int main (void) { foo(0); // expected-warning {{null passed to a callee that requires a non-null argument}} (void)sizeof(foo(0)); // expect no diagnostic in unevaluated context. SAFE_CALL(0); // expect no diagnostic for unreachable code. + foo4( + 0, // expected-warning {{null passed to a callee that requires a non-null argument}} + 0); } Index: clang/lib/Sema/SemaChecking.cpp =================================================================== --- clang/lib/Sema/SemaChecking.cpp +++ clang/lib/Sema/SemaChecking.cpp @@ -5638,7 +5638,7 @@ for (unsigned ArgIndex = 0, ArgIndexEnd = NonNullArgs.size(); ArgIndex != ArgIndexEnd; ++ArgIndex) { if (NonNullArgs[ArgIndex]) - CheckNonNullArgument(S, Args[ArgIndex], CallSiteLoc); + CheckNonNullArgument(S, Args[ArgIndex], Args[ArgIndex]->getExprLoc()); } } Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -325,6 +325,9 @@ pointers is improved to include the type of the array and whether it's cast to another type. This should improve comprehension for why an index is out-of-bounds. +- Clang now correctly point to the problematic parameter for the ``-Wnonnull`` + warning. + This fixes `Issue 58273 <https://github.com/llvm/llvm-project/issues/58273>`_. Non-comprehensive list of changes in this release -------------------------------------------------
Index: clang/test/Sema/non-null-warning.c =================================================================== --- clang/test/Sema/non-null-warning.c +++ clang/test/Sema/non-null-warning.c @@ -37,9 +37,16 @@ return 0; // expected-warning {{null returned from function that requires a non-null return value}} } +int foo4(int * _Nonnull x, int * y) { + return 0; +} + #define SAFE_CALL(X) if (X) foo(X) int main (void) { foo(0); // expected-warning {{null passed to a callee that requires a non-null argument}} (void)sizeof(foo(0)); // expect no diagnostic in unevaluated context. SAFE_CALL(0); // expect no diagnostic for unreachable code. + foo4( + 0, // expected-warning {{null passed to a callee that requires a non-null argument}} + 0); } Index: clang/lib/Sema/SemaChecking.cpp =================================================================== --- clang/lib/Sema/SemaChecking.cpp +++ clang/lib/Sema/SemaChecking.cpp @@ -5638,7 +5638,7 @@ for (unsigned ArgIndex = 0, ArgIndexEnd = NonNullArgs.size(); ArgIndex != ArgIndexEnd; ++ArgIndex) { if (NonNullArgs[ArgIndex]) - CheckNonNullArgument(S, Args[ArgIndex], CallSiteLoc); + CheckNonNullArgument(S, Args[ArgIndex], Args[ArgIndex]->getExprLoc()); } } Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -325,6 +325,9 @@ pointers is improved to include the type of the array and whether it's cast to another type. This should improve comprehension for why an index is out-of-bounds. +- Clang now correctly point to the problematic parameter for the ``-Wnonnull`` + warning. + This fixes `Issue 58273 <https://github.com/llvm/llvm-project/issues/58273>`_. Non-comprehensive list of changes in this release -------------------------------------------------
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits