diff options
| author | Shoaib Meenai <smeenai@fb.com> | 2024-08-09 13:31:43 -0700 |
|---|---|---|
| committer | Shoaib Meenai <smeenai@fb.com> | 2024-08-09 13:31:43 -0700 |
| commit | ccaad86b4d8251cddf1f4c3a400acd4b698552bf (patch) | |
| tree | 09cabcc72fad24306e07f80282645fa84b50c17b | |
| parent | 5297b750e54dafe16cc13f24b8d5478214e83682 (diff) | |
[𝘀𝗽𝗿] changes to main this commit is based onusers/smeenai/sprmain.hmaptool-implement-simple-string-deduplication-1
Created using spr 1.3.4
[skip ci]
| -rwxr-xr-x | clang/utils/hmaptool/hmaptool | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/utils/hmaptool/hmaptool b/clang/utils/hmaptool/hmaptool index d7754632b162..aa400e3dd64e 100755 --- a/clang/utils/hmaptool/hmaptool +++ b/clang/utils/hmaptool/hmaptool @@ -192,8 +192,11 @@ def action_write(name, args): key_idx = len(strtable) strtable += key + '\0' - prefix = os.path.dirname(value) + '/' - suffix = os.path.basename(value) + prefix, suffix = os.path.split(value) + # This guarantees that prefix + suffix == value in all cases, including when + # prefix is empty or contains a trailing slash or suffix is empty (hence the use + # of `len(value) - len(suffix)` instead of just `-len(suffix)`. + prefix += value[len(prefix) : len(value) - len(suffix)] prefix_idx = len(strtable) strtable += prefix + '\0' suffix_idx = len(strtable) |
