Skip to content

Commit

Permalink
Cleanup in createSymbolDatabaseIncompleteVars()
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Apr 5, 2024
1 parent d19af9b commit ee43aba
Showing 1 changed file with 1 addition and 69 deletions.
70 changes: 1 addition & 69 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1451,67 +1451,6 @@ void SymbolDatabase::createSymbolDatabaseEnums()

void SymbolDatabase::createSymbolDatabaseIncompleteVars()
{
// TODO: replace with Keywords::getX()
static const std::unordered_set<std::string> cpp20keywords = {
"alignas",
"alignof",
"axiom",
"co_await",
"co_return",
"co_yield",
"concept",
"synchronized",
"consteval",
"reflexpr",
"requires",
};
static const std::unordered_set<std::string> cppkeywords = {
"asm",
"auto",
"catch",
"char",
"class",
"const",
"constexpr",
"decltype",
"default",
"do",
"enum",
"explicit",
"export",
"extern",
"final",
"friend",
"inline",
"mutable",
"namespace",
"new",
"noexcept",
"nullptr",
"override",
"private",
"protected",
"public",
"register",
"sizeof",
"static",
"static_assert",
"struct",
"template",
"this",
"thread_local",
"throw",
"try",
"typedef",
"typeid",
"typename",
"union",
"using",
"virtual",
"void",
"volatile",
"NULL",
};
for (Token* tok = mTokenizer.list.front(); tok != mTokenizer.list.back(); tok = tok->next()) {
const Scope * scope = tok->scope();
if (!scope)
Expand All @@ -1528,7 +1467,7 @@ void SymbolDatabase::createSymbolDatabaseIncompleteVars()
tok = tok->linkAt(1);
continue;
}
if (!(tok->isNameOnly() || tok->isKeyword()))
if (tok->isKeyword() || !tok->isNameOnly())
continue;
if (tok->type())
continue;
Expand All @@ -1544,16 +1483,9 @@ void SymbolDatabase::createSymbolDatabaseIncompleteVars()
tok = tok->linkAt(1);
continue;
}
if (tok->isKeyword())
continue;
// Skip goto labels
if (Token::simpleMatch(tok->previous(), "goto"))
continue;
// TODO: handle all C/C++ standards
if (cppkeywords.count(tok->str()) > 0)
continue;
if (tok->isCpp() && (mSettings.standards.cpp >= Standards::CPP20) && cpp20keywords.count(tok->str()) > 0)
continue;
std::string fstr = tok->str();
const Token* ftok = tok->previous();
while (Token::simpleMatch(ftok, "::")) {
Expand Down

0 comments on commit ee43aba

Please sign in to comment.