[llvm-branch-commits] [llvm] 43afba0 - [gn build] sync script: try to make a loop clearer
Nico Weber via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Nov 25 18:24:13 PST 2020
Author: Nico Weber
Date: 2020-11-25T21:16:22-05:00
New Revision: 43afba0677d4630ee6a35308a4b227144b8f1d42
URL: https://github.com/llvm/llvm-project/commit/43afba0677d4630ee6a35308a4b227144b8f1d42
DIFF: https://github.com/llvm/llvm-project/commit/43afba0677d4630ee6a35308a4b227144b8f1d42.diff
LOG: [gn build] sync script: try to make a loop clearer
We want to find 'sources = [', but only if it's not the prefix
of 'sources = []' -- we're looking for a non-empty list.
No behavior change.
Added:
Modified:
llvm/utils/gn/build/sync_source_lists_from_cmake.py
Removed:
################################################################################
diff --git a/llvm/utils/gn/build/sync_source_lists_from_cmake.py b/llvm/utils/gn/build/sync_source_lists_from_cmake.py
index 5c96fd7263f4..912cf37c7e54 100755
--- a/llvm/utils/gn/build/sync_source_lists_from_cmake.py
+++ b/llvm/utils/gn/build/sync_source_lists_from_cmake.py
@@ -29,8 +29,7 @@ def patch_gn_file(gn_file, add, remove):
if add:
srcs_tok = 'sources = ['
tokloc = gn_contents.find(srcs_tok)
- while tokloc != -1 and tokloc + len(srcs_tok) < len(gn_contents) and \
- gn_contents[tokloc + len(srcs_tok)] == ']':
+ while gn_contents[tokloc:].startswith('sources = []'):
tokloc = gn_contents.find(srcs_tok, tokloc + 1)
if tokloc == -1: raise ValueError(gn_file + ': No source list')
if gn_contents.find(srcs_tok, tokloc + 1) != -1:
More information about the llvm-branch-commits
mailing list