Token::Match: removed harmless special code for initial '!!foo' patterns.
This commit is contained in:
parent
de36324d62
commit
6236e1dc38
|
@ -510,7 +510,6 @@ int Token::firstWordLen(const char *str)
|
|||
bool Token::Match(const Token *tok, const char pattern[], unsigned int varid)
|
||||
{
|
||||
const char *p = pattern;
|
||||
bool firstpattern = true;
|
||||
bool ismulticomp = false;
|
||||
while (*p) {
|
||||
// Skip spaces in pattern..
|
||||
|
@ -531,15 +530,6 @@ bool Token::Match(const Token *tok, const char pattern[], unsigned int varid)
|
|||
return false;
|
||||
}
|
||||
|
||||
// If we are in the first token, we skip all initial !! patterns
|
||||
if (firstpattern && !tok->previous() && tok->next() && p[0] == '!' && p[1] == '!' && p[2] != '\0') {
|
||||
while (*p && *p != ' ')
|
||||
++p;
|
||||
continue;
|
||||
}
|
||||
|
||||
firstpattern = false;
|
||||
|
||||
// Compare the first character of the string for optimization reasons
|
||||
// before doing more detailed checks.
|
||||
if (p[0] == '%') {
|
||||
|
|
|
@ -316,7 +316,6 @@ private:
|
|||
ASSERT_EQUALS(false, Token::Match(emptyString.tokens(), "!!else something"));
|
||||
|
||||
givenACodeSampleToTokenize ifSemicolon("if ;", true);
|
||||
ASSERT_EQUALS(true, Token::Match(ifSemicolon.tokens(), "!!return if"));
|
||||
ASSERT_EQUALS(true, Token::Match(ifSemicolon.tokens(), "if ; !!else"));
|
||||
|
||||
givenACodeSampleToTokenize ifSemicolonSomething("if ; something", true);
|
||||
|
@ -342,7 +341,7 @@ private:
|
|||
ASSERT_EQUALS(false, Token::Match(noType.tokens(), "%type%"));
|
||||
|
||||
givenACodeSampleToTokenize noType2("void delete", true);
|
||||
TODO_ASSERT_EQUALS(false, true, Token::Match(noType2.tokens(), "!!foo %type%"));
|
||||
ASSERT_EQUALS(false, Token::Match(noType2.tokens(), "!!foo %type%"));
|
||||
}
|
||||
|
||||
void matchChar() {
|
||||
|
|
|
@ -340,12 +340,6 @@ class MatchCompiler:
|
|||
break # Non-const pattern - bailout
|
||||
|
||||
pattern = res.group(1)
|
||||
|
||||
# TODO: We currently generate incorrect code for "!!" patterns
|
||||
# skip them for now until this is fixed
|
||||
if pattern.find("!!") != -1:
|
||||
break
|
||||
|
||||
line = self._replaceSpecificTokenMatch(is_simplematch, line, pos1, end_pos, pattern, tok, varId)
|
||||
|
||||
return line
|
||||
|
|
Loading…
Reference in New Issue