Clang import; Better handling of enums
This commit is contained in:
parent
b3e192a4e1
commit
569523bbef
|
@ -464,10 +464,11 @@ Scope *clangimport::AstNode::createScope(TokenList *tokenList, Scope::ScopeType
|
|||
{
|
||||
SymbolDatabase *symbolDatabase = mData->mSymbolDatabase;
|
||||
|
||||
const Scope *nestedIn = getNestedInScope(tokenList);
|
||||
Scope *nestedIn = const_cast<Scope *>(getNestedInScope(tokenList));
|
||||
|
||||
symbolDatabase->scopeList.push_back(Scope(nullptr, nullptr, nestedIn));
|
||||
Scope *scope = &symbolDatabase->scopeList.back();
|
||||
nestedIn->nestedList.push_back(scope);
|
||||
scope->type = scopeType;
|
||||
scope->classDef = def;
|
||||
Token *bodyStart = children[0]->addtoken(tokenList, "{");
|
||||
|
|
|
@ -5547,6 +5547,11 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V
|
|||
if (container) {
|
||||
valuetype->type = ValueType::Type::CONTAINER;
|
||||
valuetype->container = container;
|
||||
} else {
|
||||
const Scope *scope = type->scope();
|
||||
valuetype->typeScope = scope->check->findScope(typeTokens.front(), scope);
|
||||
if (valuetype->typeScope)
|
||||
valuetype->type = (scope->type == Scope::ScopeType::eClass) ? ValueType::Type::RECORD : ValueType::Type::NONSTD;
|
||||
}
|
||||
} else if (const Library::Container *container = settings->library.detectContainer(type)) {
|
||||
valuetype->type = ValueType::Type::CONTAINER;
|
||||
|
|
|
@ -99,6 +99,7 @@ private:
|
|||
|
||||
std::string parse(const char clang[]) {
|
||||
Settings settings;
|
||||
settings.clang = true;
|
||||
Tokenizer tokenizer(&settings, this);
|
||||
std::istringstream istr(clang);
|
||||
clangimport::parseClangAstDump(&tokenizer, istr);
|
||||
|
@ -793,6 +794,7 @@ private:
|
|||
|
||||
#define GET_SYMBOL_DB(clang) \
|
||||
Settings settings; \
|
||||
settings.clang = true; \
|
||||
settings.platform(cppcheck::Platform::PlatformType::Unix64); \
|
||||
Tokenizer tokenizer(&settings, this); \
|
||||
std::istringstream istr(clang); \
|
||||
|
@ -829,7 +831,8 @@ private:
|
|||
const Token *vartok = Token::findsimplematch(tokenizer.tokens(), "x");
|
||||
ASSERT(vartok);
|
||||
ASSERT(vartok->variable());
|
||||
//ASSERT(vartok->variable()->valueType());
|
||||
ASSERT(vartok->variable()->valueType());
|
||||
ASSERT_EQUALS(uintptr_t(&enumScope), uintptr_t(vartok->variable()->valueType()->typeScope));
|
||||
}
|
||||
|
||||
void symbolDatabaseFunction1() {
|
||||
|
|
Loading…
Reference in New Issue