xml dump: Fixed ValueFlow handling in cppcheckdata.py
This commit is contained in:
parent
2cc31acabb
commit
d003a47826
|
@ -24,6 +24,8 @@ class Token:
|
||||||
astOperand1 = None
|
astOperand1 = None
|
||||||
astOperand2Id = None
|
astOperand2Id = None
|
||||||
astOperand2 = None
|
astOperand2 = None
|
||||||
|
file = None
|
||||||
|
linenr = None
|
||||||
|
|
||||||
def __init__(self, element):
|
def __init__(self, element):
|
||||||
self.Id = element.get('id')
|
self.Id = element.get('id')
|
||||||
|
@ -47,6 +49,8 @@ class Token:
|
||||||
self.astOperand1 = None
|
self.astOperand1 = None
|
||||||
self.astOperand2Id = element.get('astOperand2')
|
self.astOperand2Id = element.get('astOperand2')
|
||||||
self.astOperand2 = None
|
self.astOperand2 = None
|
||||||
|
self.file = element.get('file')
|
||||||
|
self.linenr = element.get('linenr')
|
||||||
|
|
||||||
def setId(self, IdMap):
|
def setId(self, IdMap):
|
||||||
self.scope = IdMap[self.scopeId]
|
self.scope = IdMap[self.scopeId]
|
||||||
|
@ -139,8 +143,10 @@ class ValueFlow:
|
||||||
intvalue = None
|
intvalue = None
|
||||||
condition = None
|
condition = None
|
||||||
def __init__(self, element):
|
def __init__(self, element):
|
||||||
intvalue = element.get('intvalue')
|
self.intvalue = int(element.get('intvalue'))
|
||||||
condition = element.get('condition-line')
|
self.condition = element.get('condition-line')
|
||||||
|
if self.condition:
|
||||||
|
self.condition = int(self.condition)
|
||||||
|
|
||||||
Id = None
|
Id = None
|
||||||
values = None
|
values = None
|
||||||
|
@ -155,7 +161,7 @@ class CppcheckData:
|
||||||
scopes = []
|
scopes = []
|
||||||
functions = []
|
functions = []
|
||||||
variables = []
|
variables = []
|
||||||
values = []
|
valueflow = []
|
||||||
|
|
||||||
def __init__(self, filename):
|
def __init__(self, filename):
|
||||||
self.tokenlist = []
|
self.tokenlist = []
|
||||||
|
@ -202,7 +208,7 @@ class CppcheckData:
|
||||||
for variable in self.variables:
|
for variable in self.variables:
|
||||||
IdMap[variable.Id] = variable
|
IdMap[variable.Id] = variable
|
||||||
for values in self.valueflow:
|
for values in self.valueflow:
|
||||||
IdMap[values.Id] = values
|
IdMap[values.Id] = values.values
|
||||||
|
|
||||||
for token in self.tokenlist:
|
for token in self.tokenlist:
|
||||||
token.setId(IdMap)
|
token.setId(IdMap)
|
||||||
|
|
Loading…
Reference in New Issue