[clang-tools-extra] fix(clang-tools-extra/**.py): fix comparison to None (PR #94013)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 31 12:26:09 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tidy

Author: Eisuke Kawashima (e-kwsm)

<details>
<summary>Changes</summary>

from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations):

> Comparisons to singletons like None should always be done with is or is not, never the equality operators.

---
Full diff: https://github.com/llvm/llvm-project/pull/94013.diff


2 Files Affected:

- (modified) clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp (+1-1) 
- (modified) clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py (+1-1) 


``````````diff
diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
index 828f13805a698..1b1857124eb0f 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -1071,7 +1071,7 @@ bool IdentifierNamingCheck::isParamInMainLikeFunction(
   if (!IsIntType(FDecl->parameters()[0]->getType()))
     return false;
   MainType Type = IsCharPtrPtr(FDecl->parameters()[1]->getType());
-  if (Type == None)
+  if (Type is None)
     return false;
   if (FDecl->getNumParams() == 3 &&
       IsCharPtrPtr(FDecl->parameters()[2]->getType()) != Type)
diff --git a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py
index 6545a3906fa50..53ecb60dec539 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py
+++ b/clang-tools-extra/docs/clang-tidy/checks/gen-static-analyzer-docs.py
@@ -47,7 +47,7 @@ def get_checkers(checkers_td, checkers_rst):
         parent_package_ = package["ParentPackage"]
         hidden = (checker["Hidden"] != 0) or (package["Hidden"] != 0)
 
-        while parent_package_ != None:
+        while parent_package_ is not None:
             parent_package = table_entries[parent_package_["def"]]
             checker_package_prefix = (
                 parent_package["PackageName"] + "." + checker_package_prefix

``````````

</details>


https://github.com/llvm/llvm-project/pull/94013


More information about the cfe-commits mailing list