tkoeppe wrote:
What happens next, do we need more approvals? @EugeneZelenko?
https://github.com/llvm/llvm-project/pull/109169
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -38,7 +38,9 @@ AST_MATCHER(Type, sugaredNullptrType) {
StatementMatcher makeCastSequenceMatcher(llvm::ArrayRef NameList) {
auto ImplicitCastToNull = implicitCastExpr(
anyOf(hasCastKind(CK_NullToPointer),
hasCastKind(CK_NullToMemberPointer)),
-
unless(hasImplic
https://github.com/tkoeppe updated
https://github.com/llvm/llvm-project/pull/109169
From 07df4ed66b36fab2da9a2ae83ab85d8fcb39aa3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20K=C3=B6ppe?=
Date: Wed, 18 Sep 2024 17:04:44 +
Subject: [PATCH] [clang-tidy] Make modernize-use-nullptr matcher
@@ -38,7 +38,9 @@ AST_MATCHER(Type, sugaredNullptrType) {
StatementMatcher makeCastSequenceMatcher(llvm::ArrayRef NameList) {
auto ImplicitCastToNull = implicitCastExpr(
anyOf(hasCastKind(CK_NullToPointer),
hasCastKind(CK_NullToMemberPointer)),
-
unless(hasImplic
@@ -38,7 +38,9 @@ AST_MATCHER(Type, sugaredNullptrType) {
StatementMatcher makeCastSequenceMatcher(llvm::ArrayRef NameList) {
auto ImplicitCastToNull = implicitCastExpr(
anyOf(hasCastKind(CK_NullToPointer),
hasCastKind(CK_NullToMemberPointer)),
-
unless(hasImplic
@@ -38,7 +38,9 @@ AST_MATCHER(Type, sugaredNullptrType) {
StatementMatcher makeCastSequenceMatcher(llvm::ArrayRef NameList) {
auto ImplicitCastToNull = implicitCastExpr(
anyOf(hasCastKind(CK_NullToPointer),
hasCastKind(CK_NullToMemberPointer)),
-
unless(hasImplic
tkoeppe wrote:
@EugeneZelenko Could you please have another look?
https://github.com/llvm/llvm-project/pull/109169
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -84,6 +84,29 @@ void test_macro_expansion4() {
#undef MY_NULL
}
+template struct pear {
+ // If you say __null (or NULL), we assume that T will always be a pointer
tkoeppe wrote:
Sure, done.
https://github.com/llvm/llvm-project/pull/109169
_
https://github.com/tkoeppe updated
https://github.com/llvm/llvm-project/pull/109169
From 1149cbacb6b8376b6ed3d7651f0fa51360a67ffe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20K=C3=B6ppe?=
Date: Wed, 18 Sep 2024 17:04:44 +
Subject: [PATCH] [clang-tidy] Make modernize-use-nullptr matcher
@@ -84,6 +84,29 @@ void test_macro_expansion4() {
#undef MY_NULL
}
+template struct pear {
+ // If you say __null (or NULL), we assume that T will always be a pointer
tkoeppe wrote:
That was the whole thing we were belaboring earlier -- this test defines `N
@@ -84,6 +84,28 @@ void test_macro_expansion4() {
#undef MY_NULL
}
+template struct pear {
+ // If you say __null (or NULL), we assume that T will always be a pointer
+ // type, so we suggest replacing it with nullptr.
+ void f() { x = __null; }
+ // CHECK-MESSAGES: :[[@L
https://github.com/tkoeppe updated
https://github.com/llvm/llvm-project/pull/109169
From d4e208f89ff04cfab366cdc6849bea25613090e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20K=C3=B6ppe?=
Date: Wed, 18 Sep 2024 17:04:44 +
Subject: [PATCH] [clang-tidy] Make modernize-use-nullptr matcher
@@ -84,6 +84,28 @@ void test_macro_expansion4() {
#undef MY_NULL
}
+template struct pear {
+ // If you say __null (or NULL), we assume that T will always be a pointer
+ // type, so we suggest replacing it with nullptr.
+ void f() { x = __null; }
+ // CHECK-MESSAGES: :[[@L
https://github.com/tkoeppe updated
https://github.com/llvm/llvm-project/pull/109169
From a7ea1466bb42d701f834c984b3225120666ad4df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20K=C3=B6ppe?=
Date: Wed, 18 Sep 2024 17:04:44 +
Subject: [PATCH] [clang-tidy] Make modernize-use-nullptr matcher
https://github.com/tkoeppe updated
https://github.com/llvm/llvm-project/pull/109169
From 386d94da472178be9cdc6f5f3720be431d0744e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20K=C3=B6ppe?=
Date: Wed, 18 Sep 2024 17:04:44 +
Subject: [PATCH] [clang-tidy] Make modernize-use-nullptr matcher
https://github.com/tkoeppe updated
https://github.com/llvm/llvm-project/pull/109169
From 2e1e6b573aaee9a528c0a5af79c65f4cba94bcc1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20K=C3=B6ppe?=
Date: Wed, 18 Sep 2024 17:04:44 +
Subject: [PATCH] [clang-tidy] Make modernize-use-nullptr matcher
@@ -84,6 +84,28 @@ void test_macro_expansion4() {
#undef MY_NULL
}
+template struct pear {
+ // If you say __null (or NULL), we assume that T will always be a pointer
+ // type, so we suggest replacing it with nullptr.
+ void f() { x = __null; }
+ // CHECK-MESSAGES: :[[@L
@@ -183,6 +183,10 @@ Changes in existing checks
` check to
remove `->`, when redundant `get()` is removed.
+- Improved :doc:`modernize-use-nullptr
+ ` check to also recognize
+ `NULL`/`__null` (but not `0`) when used with a templated type.
tkoeppe wrote:
https://github.com/tkoeppe updated
https://github.com/llvm/llvm-project/pull/109169
From 2b86607a6b3d2909c2e3757b3f9e4d5f3bf5997f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20K=C3=B6ppe?=
Date: Wed, 18 Sep 2024 17:04:44 +
Subject: [PATCH] [clang-tidy] Make modernize-use-nullptr matcher
@@ -183,6 +183,10 @@ Changes in existing checks
` check to
remove `->`, when redundant `get()` is removed.
+- Improved :doc:`modernize-use-nullptr
tkoeppe wrote:
Oh I see, I didn't realize there was such an ordering. Done.
https://github.com/llvm/llvm-pr
https://github.com/tkoeppe updated
https://github.com/llvm/llvm-project/pull/109169
From 2f98433ec43d9285e1701cddd31a0d181f0bbcdc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20K=C3=B6ppe?=
Date: Wed, 18 Sep 2024 17:04:44 +
Subject: [PATCH] [clang-tidy] Make modernize-use-nullptr matcher
tkoeppe wrote:
Done!
https://github.com/llvm/llvm-project/pull/109169
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/tkoeppe updated
https://github.com/llvm/llvm-project/pull/109169
From 6077d493dfe2cbfa053a155c562475b3b41ed007 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20K=C3=B6ppe?=
Date: Wed, 18 Sep 2024 17:04:44 +
Subject: [PATCH] [clang-tidy] Make modernize-use-nullptr matcher
@@ -84,6 +84,14 @@ void test_macro_expansion4() {
#undef MY_NULL
}
+template struct pear {
+ T x;
+};
+void test_templated() {
+ pear p = { NULL };
tkoeppe wrote:
Done now. A key insight was that the test defines `NULL` as `0`, so in order
for the new che
https://github.com/tkoeppe updated
https://github.com/llvm/llvm-project/pull/109169
From d8a46761ef175194c7e7272313807d2ef25aa497 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20K=C3=B6ppe?=
Date: Wed, 18 Sep 2024 17:04:44 +
Subject: [PATCH] [clang-tidy] Make modernize-use-nullptr matcher
https://github.com/tkoeppe updated
https://github.com/llvm/llvm-project/pull/109169
From 6e056a2aad2b9b7957c18c8dfb8f64a44c7c785f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20K=C3=B6ppe?=
Date: Wed, 18 Sep 2024 17:04:44 +
Subject: [PATCH] [clang-tidy] Make modernize-use-nullptr matcher
https://github.com/tkoeppe updated
https://github.com/llvm/llvm-project/pull/109169
From d6a67729477b178d2439dfd31539a82ab7041e10 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20K=C3=B6ppe?=
Date: Wed, 18 Sep 2024 17:04:44 +
Subject: [PATCH 1/2] [clang-tidy] Make modernize-use-nullptr mat
@@ -84,6 +84,14 @@ void test_macro_expansion4() {
#undef MY_NULL
}
+template struct pear {
+ T x;
+};
+void test_templated() {
+ pear p = { NULL };
tkoeppe wrote:
It definitely does, but I was hoping that the absence would cause some kind of
test failure!
https://github.com/tkoeppe created
https://github.com/llvm/llvm-project/pull/109169
Make modernize-use-nullptr matcher also match "NULL", but not "0", when it
appears on a substituted type of a template specialization.
Previously, any matches on a substituted type were excluded, but this meant
tkoeppe wrote:
I don't have commit access and would welcome if someone else could merge this.
https://github.com/llvm/llvm-project/pull/86964
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co
https://github.com/tkoeppe created
https://github.com/llvm/llvm-project/pull/86964
Found with -Wundefined-func-template.
From 8576f816ce9873cf4212134d7cb9c985c4e04a53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20K=C3=B6ppe?=
Date: Thu, 28 Mar 2024 15:44:40 +
Subject: [PATCH] Add missi
31 matches
Mail list logo