Skip to content

Commit 5bf8776

Browse files
Address reviewer feedback
1 parent 4346e17 commit 5bf8776

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

compiler_opt/tools/make_corpus.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
2020
PYTHONPATH=$PYTHONPATH:. python3 ./compiler_opt/tools/make_corpus.py \
2121
--input_dir=<path to input directory> \
22-
--output_dir=<path to output direcotry> \
23-
--default_flags="<list of space separated flags>"
22+
--output_dir=<path to output directory> \
23+
--default_args="<list of space separated flags>"
2424
"""
2525

2626
from absl import app
@@ -32,7 +32,7 @@
3232
flags.DEFINE_string('input_dir', None, 'The input directory.')
3333
flags.DEFINE_string('output_dir', None, 'The output directory.')
3434
flags.DEFINE_string(
35-
'default_flags', '',
35+
'default_args', '',
3636
'The compiler flags to compile with when using downstream tooling.')
3737

3838
flags.mark_flag_as_required('input_dir')
@@ -50,7 +50,7 @@ def main(_):
5050
make_corpus_lib.copy_bitcode(relative_paths, FLAGS.input_dir,
5151
FLAGS.output_dir)
5252
make_corpus_lib.write_corpus_manifest(relative_paths, FLAGS.output_dir,
53-
FLAGS.default_flags.split())
53+
FLAGS.default_args.split())
5454

5555

5656
if __name__ == '__main__':

compiler_opt/tools/make_corpus_lib.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from typing import List, Optional
2323

2424

25-
def load_bitcode_from_directory(bitcode_base_dir: str):
25+
def load_bitcode_from_directory(bitcode_base_dir: str) -> List[str]:
2626
"""Finds bitcode files to extract from a given directory.
2727
2828
Args:
@@ -41,7 +41,7 @@ def load_bitcode_from_directory(bitcode_base_dir: str):
4141

4242

4343
def copy_bitcode(relative_paths: List[str], bitcode_base_dir: str,
44-
output_dir: str):
44+
output_dir: str) -> None:
4545
"""Copies bitcode files from the base directory to the output directory.
4646
4747
Args:
@@ -59,19 +59,19 @@ def copy_bitcode(relative_paths: List[str], bitcode_base_dir: str,
5959

6060
def write_corpus_manifest(relative_output_paths: List[str],
6161
output_dir: str,
62-
default_flags: Optional[List[str]] = None):
62+
default_args: Optional[List[str]] = None) -> None:
6363
"""Creates a corpus manifest describing the bitcode that has been found.
6464
6565
Args:
6666
relative_output_paths: A list of paths to each bitcode file relative to the
6767
output directory.
6868
outout_dir: The output directory where the corpus is being created.
69-
default_flags: An array of compiler flags that should be used to compile
69+
default_args: An array of compiler flags that should be used to compile
7070
the bitcode when using further downstream tooling."""
71-
if default_flags is None:
72-
default_flags = []
71+
if default_args is None:
72+
default_args = []
7373
corpus_description = {
74-
'global_command_override': default_flags,
74+
'global_command_override': default_args,
7575
'has_thinlto': False,
7676
'modules': [path for path in relative_output_paths if path is not None]
7777
}

compiler_opt/tools/make_corpus_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ def test_copy_bitcode(self):
4949
def test_write_corpus_manifest(self):
5050
relative_output_paths = ['test/test1.bc', 'test/test2.bc']
5151
output_dir = self.create_tempdir()
52-
default_flags = ['-O3', '-c']
52+
default_args = ['-O3', '-c']
5353
make_corpus_lib.write_corpus_manifest(relative_output_paths, output_dir,
54-
default_flags)
54+
default_args)
5555
with open(
5656
os.path.join(output_dir, 'corpus_description.json'),
5757
encoding='utf-8') as corpus_description_file:
5858
corpus_description = json.load(corpus_description_file)
5959
self.assertEqual(corpus_description['global_command_override'],
60-
default_flags)
60+
default_args)
6161
self.assertEqual(corpus_description['has_thinlto'], False)
6262
self.assertEqual(corpus_description['modules'], relative_output_paths)
6363

0 commit comments

Comments
 (0)