-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #13155: Tokenizer::simplifyTypedef does not set info correctly for typedef in function #6888
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,12 +267,14 @@ Token *TokenList::copyTokens(Token *dest, const Token *first, const Token *last, | |
std::stack<Token *> links; | ||
Token *tok2 = dest; | ||
int linenr = dest->linenr(); | ||
int column = dest->next() ? dest->next()->column() : dest->column() + dest->str().length() + 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the |
||
const int commonFileIndex = dest->fileIndex(); | ||
for (const Token *tok = first; tok != last->next(); tok = tok->next()) { | ||
tok2->insertToken(tok->str()); | ||
tok2 = tok2->next(); | ||
tok2->fileIndex(commonFileIndex); | ||
tok2->linenr(linenr); | ||
tok2->column(column); | ||
tok2->tokType(tok->tokType()); | ||
tok2->flags(tok->flags()); | ||
tok2->varId(tok->varId()); | ||
|
@@ -292,6 +294,9 @@ Token *TokenList::copyTokens(Token *dest, const Token *first, const Token *last, | |
|
||
links.pop(); | ||
} | ||
|
||
column += tok->next() ? tok->next()->column() - tok->column() : tok->str().length() + 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not so sure about this. At least when we replace a token it's better that the column just match the replaced token. imagine MY_INT generates a warning the warning should point at MY_INT not at some other location later.. |
||
|
||
if (!one_line && tok->next()) | ||
linenr += tok->next()->linenr() - tok->linenr(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks inconsistent. we read linenr from dest but column from dest->next().
should there be some more option for the location?