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
This commit is contained in:
Serge Guelton 2018-12-03 12:12:48 +00:00
parent 3de410848c
commit 09616bdb4a
9 changed files with 32 additions and 32 deletions

View File

@ -400,7 +400,7 @@ class Diagnostic(object):
@property
def ranges(self):
class RangeIterator:
class RangeIterator(object):
def __init__(self, diag):
self.diag = diag
@ -416,7 +416,7 @@ class Diagnostic(object):
@property
def fixits(self):
class FixItIterator:
class FixItIterator(object):
def __init__(self, diag):
self.diag = diag
@ -436,7 +436,7 @@ class Diagnostic(object):
@property
def children(self):
class ChildDiagnosticsIterator:
class ChildDiagnosticsIterator(object):
def __init__(self, diag):
self.diag_set = conf.lib.clang_getChildDiagnostics(diag)
@ -2475,8 +2475,8 @@ SpellingCache = {
# 20: CompletionChunk.Kind("VerticalSpace")
}
class CompletionChunk:
class Kind:
class CompletionChunk(object):
class Kind(object):
def __init__(self, name):
self.name = name
@ -2563,7 +2563,7 @@ completionChunkKindMap = {
20: CompletionChunk.Kind("VerticalSpace")}
class CompletionString(ClangObject):
class Availability:
class Availability(object):
def __init__(self, name):
self.name = name
@ -2656,7 +2656,7 @@ class CodeCompletionResults(ClangObject):
@property
def diagnostics(self):
class DiagnosticsItr:
class DiagnosticsItr(object):
def __init__(self, ccr):
self.ccr= ccr
@ -2958,7 +2958,7 @@ class TranslationUnit(ClangObject):
"""
Return an iterable (and indexable) object containing the diagnostics.
"""
class DiagIterator:
class DiagIterator(object):
def __init__(self, tu):
self.tu = tu
@ -4090,7 +4090,7 @@ def register_functions(lib, ignore_errors):
for f in functionList:
register(f)
class Config:
class Config(object):
library_path = None
library_file = None
compatibility_check = True

View File

@ -32,7 +32,7 @@ def indent(text, columns, indent_first_line=True):
return s
return indent + s
class Option:
class Option(object):
def __init__(self, name, type, comment):
self.name = name
self.type = type
@ -50,7 +50,7 @@ class Option:
2)
return s
class NestedStruct:
class NestedStruct(object):
def __init__(self, name, comment):
self.name = name
self.comment = comment.strip()
@ -59,7 +59,7 @@ class NestedStruct:
def __str__(self):
return '\n'.join(map(str, self.values))
class NestedField:
class NestedField(object):
def __init__(self, name, comment):
self.name = name
self.comment = comment.strip()
@ -69,7 +69,7 @@ class NestedField:
self.name,
doxygen2rst(indent(self.comment, 2, indent_first_line=False)))
class Enum:
class Enum(object):
def __init__(self, name, comment):
self.name = name
self.comment = comment.strip()
@ -78,7 +78,7 @@ class Enum:
def __str__(self):
return '\n'.join(map(str, self.values))
class EnumValue:
class EnumValue(object):
def __init__(self, name, comment):
self.name = name
self.comment = comment
@ -101,7 +101,7 @@ def clean_comment_line(line):
return line[4:] + '\n'
def read_options(header):
class State:
class State(object):
BeforeStruct, Finished, InStruct, InNestedStruct, InNestedFieldComent, \
InFieldComment, InEnum, InEnumMemberComment = range(8)
state = State.BeforeStruct

View File

@ -16,7 +16,7 @@ class ReportFailure(Exception):
# Collect information about a bug.
class BugReport:
class BugReport(object):
def __init__(self, title, description, files):
self.title = title
self.description = description
@ -37,7 +37,7 @@ from email.mime.text import MIMEText
# ReporterParameter
#===------------------------------------------------------------------------===#
class ReporterParameter:
class ReporterParameter(object):
def __init__(self, n):
self.name = n
def getName(self):
@ -75,7 +75,7 @@ class SelectionParameter (ReporterParameter):
# Reporters
#===------------------------------------------------------------------------===#
class EmailReporter:
class EmailReporter(object):
def getName(self):
return 'Email'
@ -143,7 +143,7 @@ Description: %s
return "Message sent!"
class BugzillaReporter:
class BugzillaReporter(object):
def getName(self):
return 'Bugzilla'
@ -174,7 +174,7 @@ class RadarClassificationParameter(SelectionParameter):
else:
return '7'
class RadarReporter:
class RadarReporter(object):
@staticmethod
def isAvailable():
# FIXME: Find this .scpt better

View File

@ -422,7 +422,7 @@ Submit</h3>
return self.send_string(res, 'text/plain')
def get_report_context(self, report):
class Context:
class Context(object):
pass
if report is None or report == 'None':
data = self.load_crashes()

View File

@ -10,7 +10,7 @@ from TypeGen import *
####
class TypePrinter:
class TypePrinter(object):
def __init__(self, output, outputHeader=None,
outputTests=None, outputDriver=None,
headerName=None, info=None):

View File

@ -17,7 +17,7 @@ from Enumeration import *
###
# Actual type types
class Type:
class Type(object):
def isBitField(self):
return False

View File

@ -38,7 +38,7 @@ import sys
STATS_REGEXP = re.compile(r"Statistics: (\{.+\})", re.MULTILINE | re.DOTALL)
class Colors:
class Colors(object):
"""
Color for terminal highlight.
"""
@ -50,14 +50,14 @@ class Colors:
# path - the analysis output directory
# root - the name of the root directory, which will be disregarded when
# determining the source file name
class SingleRunInfo:
class SingleRunInfo(object):
def __init__(self, path, root="", verboseLog=None):
self.path = path
self.root = root.rstrip("/\\")
self.verboseLog = verboseLog
class AnalysisDiagnostic:
class AnalysisDiagnostic(object):
def __init__(self, data, report, htmlReport):
self._data = data
self._loc = self._data['location']
@ -117,14 +117,14 @@ class AnalysisDiagnostic:
return self._data
class AnalysisReport:
class AnalysisReport(object):
def __init__(self, run, files):
self.run = run
self.files = files
self.diagnostics = []
class AnalysisRun:
class AnalysisRun(object):
def __init__(self, info):
self.path = info.path
self.root = info.root

View File

@ -12,7 +12,7 @@ import os
clang = sys.argv[1]
none_opts = 0.3
class Decl:
class Decl(object):
def __init__(self, text, depends=[], provides=[], conflicts=[]):
self.text = text
self.depends = depends
@ -39,7 +39,7 @@ decls = [
Decl('X %(name)s;\n', depends=['X']),
]
class FS:
class FS(object):
def __init__(self):
self.fs = {}
self.prevfs = {}
@ -62,7 +62,7 @@ class FS:
fs = FS()
class CodeModel:
class CodeModel(object):
def __init__(self):
self.source = ''
self.modules = {}

View File

@ -94,7 +94,7 @@ class DeltaAlgorithm(object):
###
class Token:
class Token(object):
def __init__(self, type, data, flags, file, line, column):
self.type = type
self.data = data