Skip to content

Commit 09616bd

Browse files
committedDec 3, 2018
Portable Python script across version
Have all classes derive from object: that's implicitly the default in Python3, it needs to be done explicilty in Python2. Differential Revision: https://reviews.llvm.org/D55121 llvm-svn: 348127
1 parent 3de4108 commit 09616bd

File tree

9 files changed

+32
-32
lines changed

9 files changed

+32
-32
lines changed
 

‎clang/bindings/python/clang/cindex.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def spelling(self):
400400

401401
@property
402402
def ranges(self):
403-
class RangeIterator:
403+
class RangeIterator(object):
404404
def __init__(self, diag):
405405
self.diag = diag
406406

@@ -416,7 +416,7 @@ def __getitem__(self, key):
416416

417417
@property
418418
def fixits(self):
419-
class FixItIterator:
419+
class FixItIterator(object):
420420
def __init__(self, diag):
421421
self.diag = diag
422422

@@ -436,7 +436,7 @@ def __getitem__(self, key):
436436

437437
@property
438438
def children(self):
439-
class ChildDiagnosticsIterator:
439+
class ChildDiagnosticsIterator(object):
440440
def __init__(self, diag):
441441
self.diag_set = conf.lib.clang_getChildDiagnostics(diag)
442442

@@ -2475,8 +2475,8 @@ class _CXUnsavedFile(Structure):
24752475
# 20: CompletionChunk.Kind("VerticalSpace")
24762476
}
24772477

2478-
class CompletionChunk:
2479-
class Kind:
2478+
class CompletionChunk(object):
2479+
class Kind(object):
24802480
def __init__(self, name):
24812481
self.name = name
24822482

@@ -2563,7 +2563,7 @@ def isKindResultType(self):
25632563
20: CompletionChunk.Kind("VerticalSpace")}
25642564

25652565
class CompletionString(ClangObject):
2566-
class Availability:
2566+
class Availability(object):
25672567
def __init__(self, name):
25682568
self.name = name
25692569

@@ -2656,7 +2656,7 @@ def results(self):
26562656

26572657
@property
26582658
def diagnostics(self):
2659-
class DiagnosticsItr:
2659+
class DiagnosticsItr(object):
26602660
def __init__(self, ccr):
26612661
self.ccr= ccr
26622662

@@ -2958,7 +2958,7 @@ def diagnostics(self):
29582958
"""
29592959
Return an iterable (and indexable) object containing the diagnostics.
29602960
"""
2961-
class DiagIterator:
2961+
class DiagIterator(object):
29622962
def __init__(self, tu):
29632963
self.tu = tu
29642964

@@ -4090,7 +4090,7 @@ def register(item):
40904090
for f in functionList:
40914091
register(f)
40924092

4093-
class Config:
4093+
class Config(object):
40944094
library_path = None
40954095
library_file = None
40964096
compatibility_check = True

‎clang/docs/tools/dump_format_style.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def indent(text, columns, indent_first_line=True):
3232
return s
3333
return indent + s
3434

35-
class Option:
35+
class Option(object):
3636
def __init__(self, name, type, comment):
3737
self.name = name
3838
self.type = type
@@ -50,7 +50,7 @@ def __str__(self):
5050
2)
5151
return s
5252

53-
class NestedStruct:
53+
class NestedStruct(object):
5454
def __init__(self, name, comment):
5555
self.name = name
5656
self.comment = comment.strip()
@@ -59,7 +59,7 @@ def __init__(self, name, comment):
5959
def __str__(self):
6060
return '\n'.join(map(str, self.values))
6161

62-
class NestedField:
62+
class NestedField(object):
6363
def __init__(self, name, comment):
6464
self.name = name
6565
self.comment = comment.strip()
@@ -69,7 +69,7 @@ def __str__(self):
6969
self.name,
7070
doxygen2rst(indent(self.comment, 2, indent_first_line=False)))
7171

72-
class Enum:
72+
class Enum(object):
7373
def __init__(self, name, comment):
7474
self.name = name
7575
self.comment = comment.strip()
@@ -78,7 +78,7 @@ def __init__(self, name, comment):
7878
def __str__(self):
7979
return '\n'.join(map(str, self.values))
8080

81-
class EnumValue:
81+
class EnumValue(object):
8282
def __init__(self, name, comment):
8383
self.name = name
8484
self.comment = comment
@@ -101,7 +101,7 @@ def clean_comment_line(line):
101101
return line[4:] + '\n'
102102

103103
def read_options(header):
104-
class State:
104+
class State(object):
105105
BeforeStruct, Finished, InStruct, InNestedStruct, InNestedFieldComent, \
106106
InFieldComment, InEnum, InEnumMemberComment = range(8)
107107
state = State.BeforeStruct

‎clang/tools/scan-view/share/Reporter.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, value):
1616

1717
# Collect information about a bug.
1818

19-
class BugReport:
19+
class BugReport(object):
2020
def __init__(self, title, description, files):
2121
self.title = title
2222
self.description = description
@@ -37,7 +37,7 @@ def __init__(self, title, description, files):
3737
# ReporterParameter
3838
#===------------------------------------------------------------------------===#
3939

40-
class ReporterParameter:
40+
class ReporterParameter(object):
4141
def __init__(self, n):
4242
self.name = n
4343
def getName(self):
@@ -75,7 +75,7 @@ def getHTML(self,r,bugtype,getConfigOption):
7575
# Reporters
7676
#===------------------------------------------------------------------------===#
7777

78-
class EmailReporter:
78+
class EmailReporter(object):
7979
def getName(self):
8080
return 'Email'
8181

@@ -143,7 +143,7 @@ def fileReport(self, report, parameters):
143143

144144
return "Message sent!"
145145

146-
class BugzillaReporter:
146+
class BugzillaReporter(object):
147147
def getName(self):
148148
return 'Bugzilla'
149149

@@ -174,7 +174,7 @@ def getValue(self,r,bugtype,getConfigOption):
174174
else:
175175
return '7'
176176

177-
class RadarReporter:
177+
class RadarReporter(object):
178178
@staticmethod
179179
def isAvailable():
180180
# FIXME: Find this .scpt better

‎clang/tools/scan-view/share/ScanView.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ def send_open_report(self, report):
422422
return self.send_string(res, 'text/plain')
423423

424424
def get_report_context(self, report):
425-
class Context:
425+
class Context(object):
426426
pass
427427
if report is None or report == 'None':
428428
data = self.load_crashes()

‎clang/utils/ABITest/ABITestGen.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
####
1212

13-
class TypePrinter:
13+
class TypePrinter(object):
1414
def __init__(self, output, outputHeader=None,
1515
outputTests=None, outputDriver=None,
1616
headerName=None, info=None):

‎clang/utils/ABITest/TypeGen.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
###
1818
# Actual type types
1919

20-
class Type:
20+
class Type(object):
2121
def isBitField(self):
2222
return False
2323

‎clang/utils/analyzer/CmpRuns.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
STATS_REGEXP = re.compile(r"Statistics: (\{.+\})", re.MULTILINE | re.DOTALL)
4040

41-
class Colors:
41+
class Colors(object):
4242
"""
4343
Color for terminal highlight.
4444
"""
@@ -50,14 +50,14 @@ class Colors:
5050
# path - the analysis output directory
5151
# root - the name of the root directory, which will be disregarded when
5252
# determining the source file name
53-
class SingleRunInfo:
53+
class SingleRunInfo(object):
5454
def __init__(self, path, root="", verboseLog=None):
5555
self.path = path
5656
self.root = root.rstrip("/\\")
5757
self.verboseLog = verboseLog
5858

5959

60-
class AnalysisDiagnostic:
60+
class AnalysisDiagnostic(object):
6161
def __init__(self, data, report, htmlReport):
6262
self._data = data
6363
self._loc = self._data['location']
@@ -117,14 +117,14 @@ def getRawData(self):
117117
return self._data
118118

119119

120-
class AnalysisReport:
120+
class AnalysisReport(object):
121121
def __init__(self, run, files):
122122
self.run = run
123123
self.files = files
124124
self.diagnostics = []
125125

126126

127-
class AnalysisRun:
127+
class AnalysisRun(object):
128128
def __init__(self, info):
129129
self.path = info.path
130130
self.root = info.root

‎clang/utils/modfuzz.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
clang = sys.argv[1]
1313
none_opts = 0.3
1414

15-
class Decl:
15+
class Decl(object):
1616
def __init__(self, text, depends=[], provides=[], conflicts=[]):
1717
self.text = text
1818
self.depends = depends
@@ -39,7 +39,7 @@ def apply(self, model, name):
3939
Decl('X %(name)s;\n', depends=['X']),
4040
]
4141

42-
class FS:
42+
class FS(object):
4343
def __init__(self):
4444
self.fs = {}
4545
self.prevfs = {}
@@ -62,7 +62,7 @@ def done(self):
6262

6363
fs = FS()
6464

65-
class CodeModel:
65+
class CodeModel(object):
6666
def __init__(self):
6767
self.source = ''
6868
self.modules = {}

‎clang/utils/token-delta.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def search(self, c, sets):
9494

9595
###
9696

97-
class Token:
97+
class Token(object):
9898
def __init__(self, type, data, flags, file, line, column):
9999
self.type = type
100100
self.data = data

0 commit comments

Comments
 (0)
Please sign in to comment.