[libcxx-commits] [libcxx] [libc++] Rewrite the IWYU generation (PR #78295)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 16 07:31:40 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r a9bfad2b9b04772836827c351a9365a7cbddcba0...ba2481c61141ce0f84bfe040592870c9704a4528 libcxx/utils/generate_iwyu_mapping.py libcxx/utils/libcxx/header_information.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- generate_iwyu_mapping.py 2024-01-16 15:25:26.000000 +0000
+++ generate_iwyu_mapping.py 2024-01-16 15:31:32.748781 +0000
@@ -38,32 +38,42 @@
return ["functional"]
elif header == "__fwd/pair.h":
return ["utility"]
elif header == "__fwd/subrange.h":
return ["ranges"]
- elif re.match("__fwd/(.+)[.]h", header): # Handle remaining forward declaration headers
+ elif re.match(
+ "__fwd/(.+)[.]h", header
+ ): # Handle remaining forward declaration headers
return [re.match("__fwd/(.+)[.]h", header).group(1)]
- elif re.match("__(.+?)/.+", header): # Handle detail headers for things like <__algorithm/foo.h>
+ elif re.match(
+ "__(.+?)/.+", header
+ ): # Handle detail headers for things like <__algorithm/foo.h>
return [re.match("__(.+?)/.+", header).group(1)]
else:
return None
def main():
- mappings = [] # Pairs of (header, public_header)
+ mappings = [] # Pairs of (header, public_header)
for header in libcxx.header_information.all_headers:
public_headers = IWYU_mapping(header)
if public_headers is not None:
mappings.extend((header, public) for public in public_headers)
# Validate that we only have valid public header names -- otherwise the mapping above
# needs to be updated.
- for (header, public) in mappings:
- assert public in libcxx.header_information.public_headers, f"{header}: Header {public} is not a valid header"
+ for header, public in mappings:
+ assert (
+ public in libcxx.header_information.public_headers
+ ), f"{header}: Header {public} is not a valid header"
with open(libcxx.header_information.include / "libcxx.imp", "w") as f:
f.write("[\n")
- for (header, public) in sorted(mappings):
- f.write(""" {{ include: [ "<{}>", "private", "<{}>", "public" ] }},\n""".format(header, public))
+ for header, public in sorted(mappings):
+ f.write(
+ """ {{ include: [ "<{}>", "private", "<{}>", "public" ] }},\n""".format(
+ header, public
+ )
+ )
f.write("]\n")
if __name__ == "__main__":
main()
``````````
</details>
https://github.com/llvm/llvm-project/pull/78295
More information about the libcxx-commits
mailing list