Skip to content

Commit f122e0a

Browse files
committed
dump
1 parent c0fc643 commit f122e0a

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎addons/cppcheckdata.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ class MacroUsage:
150150
useline
151151
usecolumn
152152
isKnownValue
153+
arg Argument of an integer constant macro call (INTn_C / UINTn_C), empty for other macros
153154
"""
154155
#preprocessor.cpp/Preprocessor::dump
155156

@@ -168,9 +169,10 @@ def __init__(self, element):
168169
self.useline = element.get('useline')
169170
self.usecolumn = element.get('usecolumn')
170171
self.isKnownValue = element.get('is-known-value', 'false') == 'true'
172+
self.arg = element.get('arg', '')
171173

172174
def __repr__(self):
173-
attrs = ["name", "file", "linenr", "column", "usefile", "useline", "usecolumn", "isKnownValue"]
175+
attrs = ["name", "file", "linenr", "column", "usefile", "useline", "usecolumn", "isKnownValue", "arg"]
174176
return "{}({})".format(
175177
"MacroUsage",
176178
", ".join(("{}={}".format(a, repr(getattr(self, a))) for a in attrs))

‎lib/preprocessor.cpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,8 +1116,10 @@ void Preprocessor::dump(std::ostream &out) const
11161116
<< " usefile=\"" << ErrorLogger::toxml(mSettings.relativePaths ? Path::getRelativePath(mTokens.file(macroUsage.useLocation), mSettings.basePaths) : mTokens.file(macroUsage.useLocation)) << "\""
11171117
<< " useline=\"" << macroUsage.useLocation.line << "\""
11181118
<< " usecolumn=\"" << macroUsage.useLocation.col << "\""
1119-
<< " is-known-value=\"" << bool_to_string(macroUsage.macroValueKnown) << "\""
1120-
<< "/>" << std::endl;
1119+
<< " is-known-value=\"" << bool_to_string(macroUsage.macroValueKnown) << "\"";
1120+
if (!macroUsage.arg.empty())
1121+
out << " arg=\"" << ErrorLogger::toxml(macroUsage.arg) << "\"";
1122+
out << "/>" << std::endl;
11211123
}
11221124
out << " </macro-usage>" << std::endl;
11231125
}

0 commit comments

Comments
 (0)