[libcxx][dsl] Fix mutable default argument warning

This is flagged by PyCharm and can cause subtle bugs. While changing this
also re-sort the imports and add missing ones.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D88816
This commit is contained in:
Alex Richardson 2020-10-05 22:54:22 +01:00
parent 4da4e7cb20
commit e426ae2bd5
1 changed files with 11 additions and 4 deletions

View File

@ -6,15 +6,20 @@
#
#===----------------------------------------------------------------------===##
import libcxx.test.format
import lit
import lit.util
import os
import pipes
import platform
import re
import tempfile
import libcxx.test.format
import lit
import lit.LitConfig
import lit.Test
import lit.TestRunner
import lit.util
def _memoize(f):
cache = dict()
def memoized(x):
@ -83,7 +88,7 @@ def sourceBuilds(config, source):
_executeScriptInternal(test, ['rm %t.exe'])
return exitCode == 0
def programOutput(config, program, args=[], testPrefix=''):
def programOutput(config, program, args=None, testPrefix=''):
"""
Compiles a program for the test target, run it on the test target and return
the output.
@ -92,6 +97,8 @@ def programOutput(config, program, args=[], testPrefix=''):
execution of the program is done through the %{exec} substitution, which means
that the program may be run on a remote host depending on what %{exec} does.
"""
if args is None:
args = []
with _makeConfigTest(config, testPrefix=testPrefix) as test:
with open(test.getSourcePath(), 'w') as source:
source.write(program)