diff --git a/addons/cppcheckdata.py b/addons/cppcheckdata.py index 6ac259cc8..8088ddf06 100644 --- a/addons/cppcheckdata.py +++ b/addons/cppcheckdata.py @@ -66,6 +66,8 @@ class Token: isAssignmentOp Is this token a assignment operator isComparisonOp Is this token a comparison operator isLogicalOp Is this token a logical operator: && || + isUnsigned Is this token a unsigned type + isSigned Is this token a signed type varId varId for token, each variable has a unique non-zero id variable Variable information for this token. See the Variable class. function If this token points at a function call, this attribute has the Function @@ -110,6 +112,8 @@ class Token: isAssignmentOp = False isComparisonOp = False isLogicalOp = False + isUnsigned = False + isSigned = False varId = None variableId = None variable = None @@ -141,6 +145,10 @@ class Token: type = element.get('type') if type == 'name': self.isName = True + if element.get('isUnsigned'): + self.isUnsigned = True + if element.get('isSigned'): + self.isSigned = True elif type == 'number': self.isNumber = True if element.get('isInt'): diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 921ece521..3fb1ab76f 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3850,9 +3850,13 @@ void Tokenizer::dump(std::ostream &out) const out << " linenr() << '\"'; out << " str=\"" << ErrorLogger::toxml(tok->str()) << '\"'; out << " scope=\"" << tok->scope() << '\"'; - if (tok->isName()) + if (tok->isName()) { out << " type=\"name\""; - else if (tok->isNumber()) { + if (tok->isUnsigned()) + out << " isUnsigned=\"true\""; + else if (tok->isSigned()) + out << " isSigned=\"true\""; + } else if (tok->isNumber()) { out << " type=\"number\""; if (MathLib::isInt(tok->str())) out << " isInt=\"True\"";