Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup in createSymbolDatabaseIncompleteVars() #3

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading