Skip to content

[clang-format][NFC] Use prog in clang-format-diff.py #74399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 5, 2023

Conversation

owenca
Copy link
Contributor

@owenca owenca commented Dec 5, 2023

This is a minor improvement to #73491.

@llvmbot
Copy link
Member

llvmbot commented Dec 5, 2023

@llvm/pr-subscribers-clang-format

Author: Owen Pan (owenca)

Changes

This is a minor improvement to #73491.


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

1 Files Affected:

  • (modified) clang/tools/clang-format/clang-format-diff.py (+1-2)
diff --git a/clang/tools/clang-format/clang-format-diff.py b/clang/tools/clang-format/clang-format-diff.py
index b25ee8f433751..946e28163420d 100755
--- a/clang/tools/clang-format/clang-format-diff.py
+++ b/clang/tools/clang-format/clang-format-diff.py
@@ -37,9 +37,8 @@
 
 
 def main():
-    basename = os.path.basename(sys.argv[0])
     parser = argparse.ArgumentParser(
-        description=__doc__.format(clang_format_diff=basename),
+        description=__doc__.format(clang_format_diff='%(prog)s'),
         formatter_class=argparse.RawDescriptionHelpFormatter,
     )
     parser.add_argument(

Copy link

github-actions bot commented Dec 5, 2023

✅ With the latest revision this PR passed the Python code formatter.

@serge-sans-paille
Copy link
Collaborator

Much better! You can remove the useless import os then :-)

@owenca
Copy link
Contributor Author

owenca commented Dec 5, 2023

You can remove the useless import os then :-)

Good catch!

@serge-sans-paille serge-sans-paille merged commit 900bb31 into llvm:main Dec 5, 2023
@serge-sans-paille
Copy link
Collaborator

thanks 🙇

@owenca owenca deleted the clang-format-diff branch December 6, 2023 05:17
sstipano added a commit to sstipano/llvm-project that referenced this pull request Dec 22, 2023
sstipano added a commit to sstipano/llvm-project that referenced this pull request Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants