[PATCH] D136355: [clang][Sema] Fix caret position to be on the non null parameter

2022-10-24 Thread Aaron Ballman via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1534b048d6fd: Fix caret position to be on the non null 
parameter (authored by Grillo, committed by aaron.ballman).

Repository:
  rG LLVM Github Monorepo

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
@@ -5639,7 +5639,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 
`_.
 
 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
@@ -5639,7 +5639,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 `_.
 
 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


[PATCH] D136355: [clang][Sema] Fix caret position to be on the non null parameter

2022-10-22 Thread Arthur Grillo Queiroz Cabral via Phabricator via cfe-commits
Grillo added a comment.

In D136355#3875265 , @aaron.ballman 
wrote:

> LGTM aside from a tiny grammar nit. Thank you for the fix! If you'd like me 
> to commit this on your behalf, I can fix up the release note myself when 
> landing, but please let me know what name and email address you'd like me to 
> use for patch attribution.

If you could that would be great! My name and email is Arthur Grillo 
.

Best Regards,

- Arthur Grillo


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136355/new/

https://reviews.llvm.org/D136355

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D136355: [clang][Sema] Fix caret position to be on the non null parameter

2022-10-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from a tiny grammar nit. Thank you for the fix! If you'd like me to 
commit this on your behalf, I can fix up the release note myself when landing, 
but please let me know what name and email address you'd like me to use for 
patch attribution.




Comment at: clang/docs/ReleaseNotes.rst:328
   out-of-bounds.
+- Clang now correctly point to the problematic parameter for the ``-Wnonnull``
+  warning.




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136355/new/

https://reviews.llvm.org/D136355

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D136355: [clang][Sema] Fix caret position to be on the non null parameter

2022-10-21 Thread Arthur Grillo Queiroz Cabral via Phabricator via cfe-commits
Grillo updated this revision to Diff 469605.

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 
`_.
 
 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 `_.
 
 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


[PATCH] D136355: [clang][Sema] Fix caret position to be on the non null parameter

2022-10-21 Thread Arthur Grillo Queiroz Cabral via Phabricator via cfe-commits
Grillo updated this revision to Diff 469604.

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 
`_.
 
 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 `_.
 
 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


[PATCH] D136355: [clang][Sema] Fix caret position to be on the non null parameter

2022-10-21 Thread Arthur Grillo Queiroz Cabral via Phabricator via cfe-commits
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 
`_.
 
 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 `_.
 
 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


[PATCH] D136355: [clang][Sema] Fix caret position to be on the non null parameter

2022-10-21 Thread Arthur Grillo Queiroz Cabral via Phabricator via cfe-commits
Grillo updated this revision to Diff 469559.
Grillo added a comment.

Add test coverage and release note about the fix to 
`clang/docs/ReleaseNotes.rst`


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
@@ -321,6 +321,9 @@
   on the previous undocumented behavior. As a side effect of this change,
   constructor calls outside of initializer expressions are no longer ignored,
   which can result in new warnings (or make existing warnings disappear).
+- Clang now correctly point to the problematic parameter for the ``-Wnonnull``
+  warning.
+  This fixes `Issue 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
@@ -321,6 +321,9 @@
   on the previous undocumented behavior. As a side effect of this change,
   constructor calls outside of initializer expressions are no longer ignored,
   which can result in new warnings (or make existing warnings disappear).
+- Clang now correctly point to the problematic parameter for the ``-Wnonnull``
+  warning.
+  This fixes `Issue 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


[PATCH] D136355: [clang][Sema] Fix caret position to be on the non null parameter

2022-10-20 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

Thank you for the fix!

Can you add test coverage to show the behavioral change? You can either 
position the problematic null argument on its own line (so you can validate the 
correct position) or use `-fdiagnostics-print-source-range-info` to check a 
specific range. Also, can you add a release note about the fix to 
`clang/docs/ReleaseNotes.rst`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136355/new/

https://reviews.llvm.org/D136355

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D136355: [clang][Sema] Fix caret position to be on the non null parameter

2022-10-20 Thread Arthur Grillo Queiroz Cabral via Phabricator via cfe-commits
Grillo created this revision.
Grillo added a reviewer: aaron.ballman.
Herald added a project: All.
Grillo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

When checking for non null arguments the wrong SourceLocation was given,
this fix to pass the proper argument's location.

Reported in PR58273.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136355

Files:
  clang/lib/Sema/SemaChecking.cpp


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/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());
   }
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits