Refactorization: Renamed Token::isOperator() to Token::isOperatorKeyword() to avoid confusion with Token::isOp(), use Token::isOperatorKeyword() in setVarId().
This commit is contained in:
parent
4e693f1620
commit
258e3b9dc3
|
@ -347,7 +347,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
||||||
function.nestedIn = scope;
|
function.nestedIn = scope;
|
||||||
|
|
||||||
// operator function
|
// operator function
|
||||||
if (function.tokenDef->isOperator()) {
|
if (function.tokenDef->isOperatorKeyword()) {
|
||||||
function.isOperator(true);
|
function.isOperator(true);
|
||||||
|
|
||||||
// 'operator =' is special
|
// 'operator =' is special
|
||||||
|
|
10
lib/token.h
10
lib/token.h
|
@ -374,11 +374,11 @@ public:
|
||||||
void isAttributeNothrow(bool value) {
|
void isAttributeNothrow(bool value) {
|
||||||
setFlag(fIsAttributeNothrow, value);
|
setFlag(fIsAttributeNothrow, value);
|
||||||
}
|
}
|
||||||
bool isOperator() const {
|
bool isOperatorKeyword() const {
|
||||||
return getFlag(fIsOperator);
|
return getFlag(fIsOperatorKeyword);
|
||||||
}
|
}
|
||||||
void isOperator(bool value) {
|
void isOperatorKeyword(bool value) {
|
||||||
setFlag(fIsOperator, value);
|
setFlag(fIsOperatorKeyword, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Token *findsimplematch(const Token *tok, const char pattern[]);
|
static const Token *findsimplematch(const Token *tok, const char pattern[]);
|
||||||
|
@ -784,7 +784,7 @@ private:
|
||||||
fIsAttributeNoreturn = (1 << 12), // __attribute__((noreturn)), __declspec(noreturn)
|
fIsAttributeNoreturn = (1 << 12), // __attribute__((noreturn)), __declspec(noreturn)
|
||||||
fIsAttributeNothrow = (1 << 13), // __attribute__((nothrow)), __declspec(nothrow)
|
fIsAttributeNothrow = (1 << 13), // __attribute__((nothrow)), __declspec(nothrow)
|
||||||
fIsAttributeUsed = (1 << 14), // __attribute__((used))
|
fIsAttributeUsed = (1 << 14), // __attribute__((used))
|
||||||
fIsOperator = (1 << 15) // operator=, etc
|
fIsOperatorKeyword = (1 << 15) // operator=, etc
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int _flags;
|
unsigned int _flags;
|
||||||
|
|
|
@ -2776,10 +2776,7 @@ void Tokenizer::setVarId()
|
||||||
else if (Token::Match(prev2, "%type% ( !!)") && Token::simpleMatch(tok2->link(), ") ;")) {
|
else if (Token::Match(prev2, "%type% ( !!)") && Token::simpleMatch(tok2->link(), ") ;")) {
|
||||||
// In C++ , a variable can't be called operator+ or something like that.
|
// In C++ , a variable can't be called operator+ or something like that.
|
||||||
if (isCPP() &&
|
if (isCPP() &&
|
||||||
prev2->str().size() >= 9 &&
|
prev2->isOperatorKeyword())
|
||||||
prev2->str().compare(0, 8, "operator") == 0 &&
|
|
||||||
prev2->str()[8] != '_' &&
|
|
||||||
!std::isalnum(prev2->str()[8]))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const Token *tok3 = tok2->next();
|
const Token *tok3 = tok2->next();
|
||||||
|
@ -9985,7 +9982,7 @@ void Tokenizer::simplifyOperatorName()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!op.empty())
|
if (!op.empty())
|
||||||
tok->isOperator(true);
|
tok->isOperatorKeyword(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue