Skip to content

Commit 0b4351e

Browse files
OSS-Fuzz Teamcopybara-github
authored andcommitted
clang_wrapper: Ignore linker commands when merging CDB fragments.
PiperOrigin-RevId: 816167841
1 parent 12c12d2 commit 0b4351e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

infra/base-images/base-builder/indexer/clang_wrapper.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,9 @@ def load_cdbs(directory: Path) -> Iterator[tuple[Path, dict[str, Any]]]:
511511
if file.suffix != ".json":
512512
continue
513513

514+
if file.name.endswith("_linker_commands.json"):
515+
continue
516+
514517
fragment_data = _wait_for_cdb_fragment(file)
515518
if not fragment_data:
516519
continue

infra/base-images/base-builder/indexer/clang_wrapper_test.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def test_merge_incremental_cdb(self):
8686
"output": "foo.o",
8787
"arguments": ["-c", "foo.c"],
8888
},
89+
"foo.123_linker_commands.json": {"invalid": "foo"},
8990
}
9091

9192
new_cdb_fragments = {
@@ -98,8 +99,13 @@ def test_merge_incremental_cdb(self):
9899
}
99100

100101
for cdb_fragment_path, cdb_fragment in old_cdb_fragments.items():
102+
suffix = (
103+
",\n"
104+
if not cdb_fragment_path.endswith("_linker_commands.json")
105+
else ""
106+
)
101107
(merged_cdb_path / cdb_fragment_path).write_text(
102-
json.dumps(cdb_fragment) + ",\n"
108+
json.dumps(cdb_fragment) + suffix
103109
)
104110

105111
for cdb_fragment_path, cdb_fragment in new_cdb_fragments.items():
@@ -118,6 +124,7 @@ def test_merge_incremental_cdb(self):
118124
pathlib.Path(merged_cdb_path) / "test.c.123.json",
119125
pathlib.Path(merged_cdb_path) / "test.c.aaa.json",
120126
pathlib.Path(merged_cdb_path) / "foo.c.455.json",
127+
pathlib.Path(merged_cdb_path) / "foo.123_linker_commands.json",
121128
],
122129
)
123130

0 commit comments

Comments
 (0)