diff --git a/lib/token.cpp b/lib/token.cpp index cc095cea843..9da5c45665c 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -108,10 +108,14 @@ void Token::update_property_info() if (!mStr.empty()) { if (mStr == "true" || mStr == "false") tokType(eBoolean); - else if (isStringLiteral(mStr)) + else if (isStringLiteral(mStr)) { tokType(eString); - else if (isCharLiteral(mStr)) + isLong(isPrefixStringCharLiteral(mStr, '"', "L")); + } + else if (isCharLiteral(mStr)) { tokType(eChar); + isLong(isPrefixStringCharLiteral(mStr, '\'', "L")); + } else if (std::isalpha((unsigned char)mStr[0]) || mStr[0] == '_' || mStr[0] == '$') { // Name if (mImpl->mVarId) tokType(eVariable); @@ -159,7 +163,6 @@ void Token::update_property_info() else tokType(eOther); - update_property_char_string_literal(); update_property_isStandardType(); } else { tokType(eNone); @@ -190,15 +193,6 @@ void Token::update_property_isStandardType() } } -void Token::update_property_char_string_literal() -{ - if (mTokType != Token::eString && mTokType != Token::eChar) - return; - - isLong(((mTokType == Token::eString) && isPrefixStringCharLiteral(mStr, '"', "L")) || - ((mTokType == Token::eChar) && isPrefixStringCharLiteral(mStr, '\'', "L"))); -} - bool Token::isUpperCaseName() const { if (!isName()) diff --git a/lib/token.h b/lib/token.h index 1d538bf2284..87ccea46350 100644 --- a/lib/token.h +++ b/lib/token.h @@ -1418,9 +1418,6 @@ class CPPCHECKLIB Token { /** Update internal property cache about isStandardType() */ void update_property_isStandardType(); - /** Update internal property cache about string and char literals */ - void update_property_char_string_literal(); - /** Internal helper function to avoid excessive string allocations */ void astStringVerboseRecursive(std::string& ret, const nonneg int indent1 = 0, const nonneg int indent2 = 0) const;