diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-09-15 08:49:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-09-15 08:51:14 +0200 |
commit | c3c4ae5fdac0341f01eeed8d5c633d203eed8b2a (patch) | |
tree | 8fee07cdabdb5fb8e1597a88983c79bd8512ae3c /compilerplugins/clang/unusedfields.py | |
parent | 6df2c90c08b67b943022286e7152b51d52e0ef5e (diff) |
use split() to simplify loplugin python code
Change-Id: Ib6d7acf54ca6c12a3b096435f8a621244df88b4f
Diffstat (limited to 'compilerplugins/clang/unusedfields.py')
-rwxr-xr-x | compilerplugins/clang/unusedfields.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/compilerplugins/clang/unusedfields.py b/compilerplugins/clang/unusedfields.py index 055fd37a085b..c3b51457ff58 100755 --- a/compilerplugins/clang/unusedfields.py +++ b/compilerplugins/clang/unusedfields.py @@ -25,21 +25,18 @@ def normalizeTypeParams( line ): # I have not yet found a way of suppressing the gbuild output. with io.open("loplugin.unusedfields.log", "rb", buffering=1024*1024) as txt: for line in txt: - if line.startswith("definition:\t"): - idx1 = line.find("\t",12) - idx2 = line.find("\t",idx1+1) - idx3 = line.find("\t",idx2+1) - funcInfo = (normalizeTypeParams(line[12:idx1]), line[idx1+1:idx2]) + tokens = line.strip().split("\t") + if tokens[0] == "definition:": + funcInfo = (normalizeTypeParams(tokens[1]), tokens[2]) definitionSet.add(funcInfo) - definitionToTypeMap[funcInfo] = line[idx2+1:idx3].strip() - definitionToSourceLocationMap[funcInfo] = line[idx3+1:].strip() - elif line.startswith("touch:\t"): - idx1 = line.find("\t",7) - callInfo = (normalizeTypeParams(line[7:idx1]), line[idx1+1:].strip()) + definitionToTypeMap[funcInfo] = tokens[3] + definitionToSourceLocationMap[funcInfo] = tokens[4] + elif tokens[0] == "touch:": + callInfo = (normalizeTypeParams(tokens[1]), tokens[2]) callSet.add(callInfo) - elif line.startswith("read:\t"): + elif tokens[0] == "read:": idx1 = line.find("\t",6) - readInfo = (normalizeTypeParams(line[6:idx1]), line[idx1+1:].strip()) + readInfo = (normalizeTypeParams(tokens[1]), tokens[2]) readFromSet.add(readInfo) # Invert the definitionToSourceLocationMap |