Skip to content

Commit c58dec9

Browse files
committed
Better test this better before pushing.
Revert "pylint driven code clean up." This reverts commit 4bb0970.
1 parent 4bb0970 commit c58dec9

14 files changed

+314
-721
lines changed

.pylintrc

Lines changed: 0 additions & 407 deletions
This file was deleted.

Makefile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ all:
2727

2828

2929
#local editable install for developing
30-
develop:
30+
develop:
3131
pip install -e .
3232

3333

@@ -36,7 +36,7 @@ dist: clean
3636

3737
# If you need to push this project again,
3838
# INCREASE the version number in wllvm/version.py,
39-
# otherwise the server will give you an error.
39+
# otherwise the server will give you an error.
4040

4141
testpublish: dist
4242
python setup.py register -r https://testpypi.python.org/pypi
@@ -50,7 +50,7 @@ publish: dist
5050
python setup.py sdist upload -r https://pypi.python.org/pypi
5151

5252
install:
53-
pip install
53+
pip install
5454

5555
check_clang:
5656
cd test; python -m unittest -v test_base_driver test_clang_driver
@@ -74,6 +74,4 @@ lint:
7474
ifeq ($(PYLINT),)
7575
$(error lint target requires pylint)
7676
endif
77-
# @ $(PYLINT) -E wllvm/*.py
78-
# for detecting more than just errors:
79-
@ $(PYLINT) --rcfile=.pylintrc wllvm/*.py
77+
@ $(PYLINT) -E wllvm/*.py

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
# use the in house version number so we stay in synch with ourselves.
1515
from wllvm.version import wllvm_version
16-
16+
1717
setup(
1818
name='wllvm',
19-
version=wllvm_version,
19+
version=wllvm_version,
2020
description='Whole Program LLVM',
2121
long_description=long_description,
2222
url='https://github.com/SRI-CSL/whole-program-llvm',
@@ -25,9 +25,9 @@
2525

2626

2727
include_package_data=True,
28-
28+
2929
packages=find_packages(),
30-
30+
3131
entry_points = {
3232
'console_scripts': [
3333
'wllvm-as = wllvm.as:main',
@@ -39,7 +39,7 @@
3939
},
4040

4141
license='MIT',
42-
42+
4343
classifiers=[
4444
'Development Status :: 4 - Beta',
4545
'Natural Language :: English',

wllvm/arglistfilter.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import logging
2-
import collections
3-
import os
4-
import re
5-
import sys
1+
import logging, collections, os, re, sys
62

73
# Internal logger
84
_logger = logging.getLogger(__name__)
@@ -127,8 +123,8 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
127123
# Debug
128124
'-g' : (0, ArgumentListFilter.compileUnaryCallback),
129125
'-g0' : (0, ArgumentListFilter.compileUnaryCallback), #iam: clang not gcc
130-
'-ggdb' : (0, ArgumentListFilter.compileUnaryCallback),
131-
'-ggdb3' : (0, ArgumentListFilter.compileUnaryCallback),
126+
'-ggdb' : (0, ArgumentListFilter.compileUnaryCallback),
127+
'-ggdb3' : (0, ArgumentListFilter.compileUnaryCallback),
132128
'-gdwarf-2' : (0, ArgumentListFilter.compileUnaryCallback),
133129
'-gdwarf-3' : (0, ArgumentListFilter.compileUnaryCallback),
134130
'-gline-tables-only' : (0, ArgumentListFilter.compileUnaryCallback),
@@ -189,7 +185,7 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
189185
# (the Darwin ld is a bit single minded)
190186
#
191187
# 1) compilation with -fvisibility=hidden causes trouble when we try to
192-
# attach bitcode filenames to an object file. The global symbols in object
188+
# attach bitcode filenames to an object file. The global symbols in object
193189
# files get turned into local symbols when we invoke 'ld -r'
194190
#
195191
# 2) all stripping commands (e.g., -dead_strip) remove the __LLVM segment after
@@ -199,8 +195,8 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
199195
# calling ld -r.
200196
#
201197
'-Wl,-dead_strip' : (0, ArgumentListFilter.darwinWarningLinkUnaryCallback),
202-
203-
}
198+
199+
}
204200

205201
#
206202
# Patterns for other command-line arguments:
@@ -231,15 +227,15 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
231227
r'^--sysroot=.+$' : (0, ArgumentListFilter.compileUnaryCallback),
232228
r'^-print-prog-name=.*$' : (0, ArgumentListFilter.compileUnaryCallback),
233229
r'^-print-file-name=.*$' : (0, ArgumentListFilter.compileUnaryCallback),
234-
230+
235231
}
236232

237233
#iam: try and keep track of the files, input object, and output
238234
self.inputList = inputList
239235
self.inputFiles = []
240236
self.objectFiles = []
241237
self.outputFilename = None
242-
238+
243239
#iam: try and split the args into linker and compiler switches
244240
self.compileArgs = []
245241
self.linkArgs = []
@@ -260,10 +256,10 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
260256
self._inputArgs = collections.deque(inputList)
261257

262258
#iam: parse the cmd line, bailing if we discover that there will be no second phase.
263-
while (len(self._inputArgs) > 0 and
264-
not (self.isAssembly or
265-
self.isAssembleOnly or
266-
self.isPreprocessOnly)):
259+
while ( len(self._inputArgs) > 0 and
260+
not (self.isAssembly or
261+
self.isAssembleOnly or
262+
self.isPreprocessOnly ) ):
267263
# Get the next argument
268264
currentItem = self._inputArgs.popleft()
269265
_logger.debug('Trying to match item ' + currentItem)
@@ -285,7 +281,7 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
285281
# If no action has been specified, this is a zero-argument
286282
# flag that we should just keep.
287283
if not matched:
288-
_logger.warning('Did not recognize the compiler flag "%s"', currentItem)
284+
_logger.warning('Did not recognize the compiler flag "{0}"'.format(currentItem))
289285
self.compileUnaryCallback(currentItem)
290286

291287
if DUMPING:
@@ -300,11 +296,11 @@ def _shiftArgs(self, nargs):
300296
return ret
301297

302298
def abortUnaryCallback(self, flag):
303-
_logger.warning('Out of context experience: "%s"', str(self.inputList))
299+
_logger.warning('Out of context experience: "{0}"'.format(str(self.inputList)))
304300
sys.exit(1)
305301

306302
def inputFileCallback(self, infile):
307-
_logger.debug('Input file: %s', infile)
303+
_logger.debug('Input file: ' + infile)
308304
self.inputFiles.append(infile)
309305
if re.search('\\.(s|S)$', infile):
310306
self.isAssembly = True
@@ -339,13 +335,13 @@ def compileUnaryCallback(self, flag):
339335

340336
def darwinWarningLinkUnaryCallback(self, flag):
341337
if sys.platform.startswith('darwin'):
342-
_logger.warning('The flag "%s" cannot be used with this tool', flag)
338+
_logger.warning('The flag "{0}" cannot be used with this tool'.format(flag))
343339
sys.exit(1)
344340
else:
345341
self.linkArgs.append(flag)
346342

347343
def defaultBinaryCallback(self, flag, arg):
348-
_logger.warning('Ignoring compiler arg pair: "%s %s"', flag, arg)
344+
_logger.warning('Ignoring compiler arg pair: "{0} {1}"'.format(flag, arg))
349345

350346
def dependencyBinaryCallback(self, flag, arg):
351347
self.isDependencyOnly = True
@@ -396,11 +392,15 @@ def getArtifactNames(self, srcFile, hidden=False):
396392

397393
#iam: for printing our partitioning of the args
398394
def dump(self):
399-
_logger.debug('compileArgs: %s\ninputFiles: %s\nlinkArgs: %s',
400-
self.compileArgs, self.inputFiles, self.linkArgs)
401-
_logger.debug('objectFiles: %s\noutputFilename: %s',
402-
self.objectFiles, self.outputFilename)
395+
_logger.debug('compileArgs: {0}'.format(self.compileArgs))
396+
_logger.debug('inputFiles: {0}'.format(self.inputFiles))
397+
_logger.debug('linkArgs: {0}'.format(self.linkArgs))
398+
_logger.debug('objectFiles: {0}'.format(self.objectFiles))
399+
_logger.debug('outputFilename: {0}'.format(self.outputFilename))
403400
for srcFile in self.inputFiles:
404-
_logger.debug('srcFile: %s', srcFile)
401+
_logger.debug('srcFile: {0}'.format(srcFile))
405402
(objFile, bcFile) = self.getArtifactNames(srcFile)
406-
_logger.debug('%s ===> (%s, %s)', srcFile, objFile, bcFile)
403+
_logger.debug('{0} ===> ({1}, {2})'.format(srcFile, objFile, bcFile))
404+
405+
406+

wllvm/as.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
"""This is the (dragonegg) assembler phase.
2+
"""This is the (dragonegg) assembler phase.
33
44
This variant is only invoked during the second compilation where we
55
are building bitcode. The compiler has already been instructed to
@@ -53,7 +53,7 @@ def outFileCallback(self, flag, name):
5353
self.outFileName = name
5454

5555
def main():
56-
56+
5757
argFilter = BCFilter(sys.argv[1:])
5858
# Since this is just the assembler, there should only ever be one file
5959
try:
@@ -72,7 +72,7 @@ def main():
7272
if not argFilter.outFileName:
7373
logging.error('Output file argument not found.')
7474
sys.exit(1)
75-
75+
7676
fakeAssembler = [llvmAssembler, infile, '-o', argFilter.outFileName]
7777

7878
asmProc = Popen(fakeAssembler)
@@ -84,6 +84,6 @@ def main():
8484

8585
sys.exit(realRet)
8686

87-
87+
8888
if __name__ == '__main__':
8989
sys.exit(main())

0 commit comments

Comments
 (0)