Skip to content

Commit 210737e

Browse files
committed
perf: Speedup root_relative_path
1 parent 01c27aa commit 210737e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cc/common/cc_helper_internal.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ def root_relative_path(file):
354354
(str) The root-relative path of the file.
355355
"""
356356
if not file.is_source:
357+
if file.path.startswith(file.root.path + "/"):
358+
# TODO(zbarsky): is this always the case?
359+
return file.path[len(file.root.path) + 1:]
357360
return paths.relativize(file.path, file.root.path)
358361
short_path = file.short_path
359362
if not short_path.startswith("../"):

0 commit comments

Comments
 (0)