Skip to content

Commit 0aaeca1

Browse files
committed
[cmpcodesize] Reuse shortcuts as global constant
Two parts of the code reference the shorthand for specified PerfTests_* directories. Promote them to a constant and reuse them.
1 parent 9c3c25e commit 0aaeca1

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

utils/cmpcodesize

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ Infixes = {
3939
"q_" : "Generic Function"
4040
}
4141

42+
SHORTCUTS = {
43+
"O": "bin/PerfTests_O",
44+
"Ounchecked": "bin/PerfTests_Ounchecked",
45+
"Onone": "bin/PerfTests_Onone",
46+
"dylib": "lib/swift/macosx/x86_64/libswiftCore.dylib",
47+
}
48+
4249
GenericFunctionPrefix = "__TTSg"
4350

4451
SortedPrefixes = sorted(Prefixes)
@@ -371,19 +378,14 @@ How to specify files:
371378
'$SWIFT_NEW_BUILDDIR environment variables set.\n' + \
372379
'$SWIFT_OLD_BUILDDIR = {0}\n$SWIFT_NEW_BUILDDIR = {1}'.format(
373380
oldBuildDir, newBuildDir)
374-
oldFileArgs = [ "O", "Ounchecked", "Onone", "dylib" ]
381+
oldFileArgs = SHORTCUTS.keys()
382+
375383
oldFiles = []
376384
newFiles = []
377385
numExpanded = 0
378386
for file in oldFileArgs:
379-
shortcuts = {
380-
"O" : "bin/PerfTests_O",
381-
"Ounchecked" : "bin/PerfTests_Ounchecked",
382-
"Onone" : "bin/PerfTests_Onone",
383-
"dylib" : "lib/swift/macosx/x86_64/libswiftCore.dylib"
384-
}
385-
if file in shortcuts:
386-
file = shortcuts[file]
387+
if file in SHORTCUTS:
388+
file = SHORTCUTS[file]
387389

388390
if not file.startswith("./") and oldBuildDir and newBuildDir:
389391
oldExpanded = glob.glob(oldBuildDir + "/" + file)

0 commit comments

Comments
 (0)