Skip to content

Commit 1dc9543

Browse files
committed
Fix #14988: Add relative path to preprocessor dump
1 parent ff4d7ce commit 1dc9543

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/preprocessor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,10 +1067,10 @@ void Preprocessor::dump(std::ostream &out) const
10671067
for (const simplecpp::MacroUsage &macroUsage: mMacroUsage) {
10681068
out << " <macro"
10691069
<< " name=\"" << macroUsage.macroName << "\""
1070-
<< " file=\"" << ErrorLogger::toxml(mTokens.file(macroUsage.macroLocation)) << "\""
1070+
<< " file=\"" << ErrorLogger::toxml(mSettings.relativePaths ? Path::getRelativePath(mTokens.file(macroUsage.macroLocation), mSettings.basePaths) : mTokens.file(macroUsage.macroLocation)) << "\""
10711071
<< " line=\"" << macroUsage.macroLocation.line << "\""
10721072
<< " column=\"" << macroUsage.macroLocation.col << "\""
1073-
<< " usefile=\"" << ErrorLogger::toxml(mTokens.file(macroUsage.useLocation)) << "\""
1073+
<< " usefile=\"" << ErrorLogger::toxml(mSettings.relativePaths ? Path::getRelativePath(mTokens.file(macroUsage.useLocation), mSettings.basePaths) : mTokens.file(macroUsage.useLocation)) << "\""
10741074
<< " useline=\"" << macroUsage.useLocation.line << "\""
10751075
<< " usecolumn=\"" << macroUsage.useLocation.col << "\""
10761076
<< " is-known-value=\"" << bool_to_string(macroUsage.macroValueKnown) << "\""
@@ -1083,7 +1083,7 @@ void Preprocessor::dump(std::ostream &out) const
10831083
out << " <simplecpp-if-cond>" << std::endl;
10841084
for (const simplecpp::IfCond &ifCond: mIfCond) {
10851085
out << " <if-cond"
1086-
<< " file=\"" << ErrorLogger::toxml(mTokens.file(ifCond.location)) << "\""
1086+
<< " file=\"" << ErrorLogger::toxml(mSettings.relativePaths ? Path::getRelativePath(mTokens.file(ifCond.location), mSettings.basePaths) : mTokens.file(ifCond.location)) << "\""
10871087
<< " line=\"" << ifCond.location.line << "\""
10881088
<< " column=\"" << ifCond.location.col << "\""
10891089
<< " E=\"" << ErrorLogger::toxml(ifCond.E) << "\""

0 commit comments

Comments
 (0)