mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-01 14:58:18 +00:00

VSCode's Pylance extension informed me, and text searching confirmed, that these imports are unused. I believe we should be able to remove them harmlessly.
47 lines
1.4 KiB
Python
Executable File
47 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python
|
|
# ===----------------------------------------------------------------------===##
|
|
#
|
|
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
# See https://llvm.org/LICENSE.txt for license information.
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
#
|
|
# ===----------------------------------------------------------------------===##
|
|
|
|
import argparse
|
|
|
|
if __name__ == "__main__":
|
|
"""Converts a header dependency CSV file to Graphviz dot file.
|
|
|
|
The header dependency CSV files are found on the directory
|
|
libcxx/test/libcxx/transitive_includes
|
|
"""
|
|
|
|
parser = argparse.ArgumentParser(
|
|
description="""Converts a libc++ dependency CSV file to a Graphviz dot file.
|
|
For example:
|
|
libcxx/utils/graph_header_deps.py libcxx/test/libcxx/transitive_includes/cxx20.csv | dot -Tsvg > graph.svg
|
|
""",
|
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
)
|
|
parser.add_argument(
|
|
"input",
|
|
default=None,
|
|
metavar="FILE",
|
|
help="The header dependency CSV file.",
|
|
)
|
|
options = parser.parse_args()
|
|
|
|
print(
|
|
"""digraph includes {
|
|
graph [nodesep=0.5, ranksep=1];
|
|
node [shape=box, width=4];"""
|
|
)
|
|
with open(options.input, "r") as f:
|
|
for line in f.readlines():
|
|
elements = line.rstrip().split(" ")
|
|
assert len(elements) == 2
|
|
|
|
print(f'\t"{elements[0]}" -> "{elements[1]}"')
|
|
|
|
print("}")
|