Skip to content

Commit 828e903

Browse files
authored
Fix #14224: Add lineno. in typedef tokens in dumpfile (#7935)
1 parent 71a4af2 commit 828e903

File tree

2 files changed

+30
-27
lines changed

2 files changed

+30
-27
lines changed

lib/tokenize.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6318,6 +6318,9 @@ std::string Tokenizer::dumpTypedefInfo() const
63186318
outs += '\n';
63196319
for (const auto& t : typedefInfo.typedefInfoTokens) {
63206320
outs += " <token ";
6321+
outs += "line=\"";
6322+
outs += std::to_string(t.lineNumber);
6323+
outs += "\" ";
63216324
outs += "column=\"";
63226325
outs += std::to_string(t.column);
63236326
outs += "\" ";

test/testsimplifytypedef.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4557,36 +4557,36 @@ class TestSimplifyTypedef : public TestFixture {
45574557
"}\n");
45584558
ASSERT_EQUALS(" <typedef-info>\n"
45594559
" <info name=\"fp16\" file=\"file.c\" line=\"2\" column=\"1\" used=\"1\" isFunctionPointer=\"1\">\n"
4560-
" <token column=\"1\" str=\"typedef\"/>\n"
4561-
" <token column=\"9\" str=\"void\"/>\n"
4562-
" <token column=\"14\" str=\"(\"/>\n"
4563-
" <token column=\"16\" str=\"*\"/>\n"
4564-
" <token column=\"17\" str=\"fp16\"/>\n"
4565-
" <token column=\"22\" str=\")\"/>\n"
4566-
" <token column=\"23\" str=\"(\"/>\n"
4567-
" <token column=\"25\" str=\"int16_t\"/>\n"
4568-
" <token column=\"33\" str=\"n\"/>\n"
4569-
" <token column=\"35\" str=\")\"/>\n"
4560+
" <token line=\"2\" column=\"1\" str=\"typedef\"/>\n"
4561+
" <token line=\"2\" column=\"9\" str=\"void\"/>\n"
4562+
" <token line=\"2\" column=\"14\" str=\"(\"/>\n"
4563+
" <token line=\"2\" column=\"16\" str=\"*\"/>\n"
4564+
" <token line=\"2\" column=\"17\" str=\"fp16\"/>\n"
4565+
" <token line=\"2\" column=\"22\" str=\")\"/>\n"
4566+
" <token line=\"2\" column=\"23\" str=\"(\"/>\n"
4567+
" <token line=\"2\" column=\"25\" str=\"int16_t\"/>\n"
4568+
" <token line=\"2\" column=\"33\" str=\"n\"/>\n"
4569+
" <token line=\"2\" column=\"35\" str=\")\"/>\n"
45704570
" </info>\n"
45714571
" <info name=\"int16_t\" file=\"file.c\" line=\"1\" column=\"1\" used=\"1\" isFunctionPointer=\"0\"/>\n"
45724572
" <info name=\"pfp16\" file=\"file.c\" line=\"4\" column=\"20\" used=\"0\" isFunctionPointer=\"1\">\n"
4573-
" <token column=\"4\" str=\"typedef\"/>\n"
4574-
" <token column=\"12\" str=\"void\"/>\n"
4575-
" <token column=\"12\" str=\"(\"/>\n"
4576-
" <token column=\"12\" str=\"*\"/>\n"
4577-
" <token column=\"17\" str=\"(\"/>\n"
4578-
" <token column=\"19\" str=\"*\"/>\n"
4579-
" <token column=\"20\" str=\"pfp16\"/>\n"
4580-
" <token column=\"26\" str=\")\"/>\n"
4581-
" <token column=\"28\" str=\"(\"/>\n"
4582-
" <token column=\"30\" str=\"void\"/>\n"
4583-
" <token column=\"35\" str=\")\"/>\n"
4584-
" <token column=\"35\" str=\")\"/>\n"
4585-
" <token column=\"35\" str=\"(\"/>\n"
4586-
" <token column=\"35\" str=\"signed\"/>\n"
4587-
" <token column=\"35\" str=\"short\"/>\n"
4588-
" <token column=\"35\" str=\"n\"/>\n"
4589-
" <token column=\"35\" str=\")\"/>\n"
4573+
" <token line=\"4\" column=\"4\" str=\"typedef\"/>\n"
4574+
" <token line=\"4\" column=\"12\" str=\"void\"/>\n"
4575+
" <token line=\"4\" column=\"12\" str=\"(\"/>\n"
4576+
" <token line=\"4\" column=\"12\" str=\"*\"/>\n"
4577+
" <token line=\"4\" column=\"17\" str=\"(\"/>\n"
4578+
" <token line=\"4\" column=\"19\" str=\"*\"/>\n"
4579+
" <token line=\"4\" column=\"20\" str=\"pfp16\"/>\n"
4580+
" <token line=\"4\" column=\"26\" str=\")\"/>\n"
4581+
" <token line=\"4\" column=\"28\" str=\"(\"/>\n"
4582+
" <token line=\"4\" column=\"30\" str=\"void\"/>\n"
4583+
" <token line=\"4\" column=\"35\" str=\")\"/>\n"
4584+
" <token line=\"4\" column=\"35\" str=\")\"/>\n"
4585+
" <token line=\"4\" column=\"35\" str=\"(\"/>\n"
4586+
" <token line=\"4\" column=\"35\" str=\"signed\"/>\n"
4587+
" <token line=\"4\" column=\"35\" str=\"short\"/>\n"
4588+
" <token line=\"4\" column=\"35\" str=\"n\"/>\n"
4589+
" <token line=\"4\" column=\"35\" str=\")\"/>\n"
45904590
" </info>\n"
45914591
" </typedef-info>\n",xml);
45924592
}

0 commit comments

Comments
 (0)