[clang-tools-extra] [clang-tidy] Add type annotations to add_new_check.py, fix minor bug (PR #106801)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 31 09:02:02 PDT 2024


================
@@ -754,7 +765,7 @@ def main():
         language_restrict = (
             f"%(lang)s.{cpp_language_to_requirements.get(args.standard, 'CPlusPlus')}"
         )
-    elif language in ["objc", "objc++"]:
+    else:  # "objc" or "objc++"
         language_restrict = "%(lang)s.ObjC"
----------------
5chmidti wrote:

This change would result in any language string that is not supported setting the language restriction to `ObjC` (e.g., `--language CUDA`).
I'd say keep the `elif` and do a
```c++
if language_restrict is None:
    print(f"Unsupported language '{language}' was specified")
```
afterward

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


More information about the cfe-commits mailing list