@@ -2195,24 +2195,28 @@ void TokenList::simplifyStdType()
21952195bool TokenList::isKeyword (const std::string &str) const
21962196{
21972197 if (isCPP ()) {
2198- // TODO: integrate into keywords?
2199- // types and literals are not handled as keywords
2200- static const std::unordered_set<std::string> cpp_types = {" bool" , " false" , " true" };
2201- if (cpp_types.find (str) != cpp_types.end ())
2202- return false ;
2203-
22042198 const auto &cpp_keywords = Keywords::getAll (mSettings .standards .cpp );
2205- return cpp_keywords.find (str) != cpp_keywords.end ();
2199+ const bool b = cpp_keywords.find (str) != cpp_keywords.end ();
2200+ if (b) {
2201+ // TODO: integrate into keywords?
2202+ // types and literals are not handled as keywords
2203+ static const std::unordered_set<std::string> cpp_types = {" bool" , " false" , " true" };
2204+ if (cpp_types.find (str) != cpp_types.end ())
2205+ return false ;
2206+ }
2207+ return b;
22062208 }
22072209
2208- // TODO: integrate into Keywords?
2209- // types are not handled as keywords
2210- static const std::unordered_set<std::string> c_types = {" char" , " double" , " float" , " int" , " long" , " short" };
2211- if (c_types.find (str) != c_types.end ())
2212- return false ;
2213-
22142210 const auto &c_keywords = Keywords::getAll (mSettings .standards .c );
2215- return c_keywords.find (str) != c_keywords.end ();
2211+ const bool b = c_keywords.find (str) != c_keywords.end ();
2212+ if (b) {
2213+ // TODO: integrate into Keywords?
2214+ // types are not handled as keywords
2215+ static const std::unordered_set<std::string> c_types = {" char" , " double" , " float" , " int" , " long" , " short" };
2216+ if (c_types.find (str) != c_types.end ())
2217+ return false ;
2218+ }
2219+ return b;
22162220}
22172221
22182222bool TokenList::isC () const
0 commit comments