@@ -2195,24 +2195,28 @@ void TokenList::simplifyStdType()
2195
2195
bool TokenList::isKeyword (const std::string &str) const
2196
2196
{
2197
2197
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
-
2204
2198
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;
2206
2208
}
2207
2209
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
-
2214
2210
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;
2216
2220
}
2217
2221
2218
2222
bool TokenList::isC () const
0 commit comments