Tokenizer::simplifyTypedef: 'tokAt(offset)=>tokOffset': work in progress..
This commit is contained in:
parent
fa077ede94
commit
b366bf69ad
|
@ -1202,11 +1202,11 @@ void Tokenizer::simplifyTypedef()
|
||||||
}
|
}
|
||||||
|
|
||||||
// typeof: typedef __typeof__ ( ... ) type;
|
// typeof: typedef __typeof__ ( ... ) type;
|
||||||
else if (Token::simpleMatch(tok->tokAt(offset - 1), "__typeof__ (") &&
|
else if (Token::simpleMatch(tokOffset->previous(), "__typeof__ (") &&
|
||||||
Token::Match(tok->linkAt(offset), ") %type% ;")) {
|
Token::Match(tokOffset->link(), ") %type% ;")) {
|
||||||
argStart = tok->tokAt(offset);
|
argStart = tokOffset;
|
||||||
argEnd = tok->linkAt(offset);
|
argEnd = tokOffset->link();
|
||||||
typeName = tok->linkAt(offset)->next();
|
typeName = tokOffset->link()->next();
|
||||||
tok = typeName->next();
|
tok = typeName->next();
|
||||||
typeOf = true;
|
typeOf = true;
|
||||||
}
|
}
|
||||||
|
@ -1214,24 +1214,26 @@ void Tokenizer::simplifyTypedef()
|
||||||
// function: typedef ... ( .... type )( ... );
|
// function: typedef ... ( .... type )( ... );
|
||||||
// typedef ... (( .... type )( ... ));
|
// typedef ... (( .... type )( ... ));
|
||||||
// typedef ... ( * ( .... type )( ... ));
|
// typedef ... ( * ( .... type )( ... ));
|
||||||
else if ((tok->strAt(offset) == "(" &&
|
else if ((tokOffset->str() == "(" &&
|
||||||
Token::Match(tok->linkAt(offset)->previous(), "%type% ) (") &&
|
Token::Match(tokOffset->link()->previous(), "%type% ) (") &&
|
||||||
Token::Match(tok->linkAt(offset)->next()->link(), ") const|volatile|;")) ||
|
Token::Match(tokOffset->link()->next()->link(), ") const|volatile|;")) ||
|
||||||
(Token::simpleMatch(tok->tokAt(offset), "( (") &&
|
(Token::simpleMatch(tokOffset, "( (") &&
|
||||||
Token::Match(tok->linkAt(offset + 1)->previous(), "%type% ) (") &&
|
Token::Match(tokOffset->next()->link()->previous(), "%type% ) (") &&
|
||||||
Token::Match(tok->linkAt(offset + 1)->next()->link(), ") const|volatile| ) ;|,")) ||
|
Token::Match(tokOffset->next()->link()->next()->link(), ") const|volatile| ) ;|,")) ||
|
||||||
(Token::simpleMatch(tok->tokAt(offset), "( * (") &&
|
(Token::simpleMatch(tokOffset, "( * (") &&
|
||||||
Token::Match(tok->linkAt(offset + 2)->previous(), "%type% ) (") &&
|
Token::Match(tokOffset->linkAt(2)->previous(), "%type% ) (") &&
|
||||||
Token::Match(tok->linkAt(offset + 2)->next()->link(), ") const|volatile| ) ;|,"))) {
|
Token::Match(tokOffset->linkAt(2)->next()->link(), ") const|volatile| ) ;|,"))) {
|
||||||
if (tok->strAt(offset + 1) == "(")
|
if (tokOffset->next()->str() == "(") {
|
||||||
++offset;
|
++offset;
|
||||||
else if (Token::simpleMatch(tok->tokAt(offset), "( * (")) {
|
tokOffset = tokOffset->next();
|
||||||
|
} else if (Token::simpleMatch(tokOffset, "( * (")) {
|
||||||
++offset;
|
++offset;
|
||||||
pointers.push_back("*");
|
pointers.push_back("*");
|
||||||
++offset;
|
++offset;
|
||||||
|
tokOffset = tokOffset->tokAt(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok->linkAt(offset)->strAt(-2) == "*")
|
if (tokOffset->link()->strAt(-2) == "*")
|
||||||
functionPtr = true;
|
functionPtr = true;
|
||||||
else
|
else
|
||||||
function = true;
|
function = true;
|
||||||
|
|
Loading…
Reference in New Issue