@@ -1178,21 +1178,33 @@ void clangimport::AstNode::createTokensFunctionDecl(TokenList *tokenList)
11781178void clangimport::AstNode::createTokensForCXXRecord (TokenList *tokenList)
11791179{
11801180 bool isStruct = (std::find (mExtTokens .begin (), mExtTokens .end (), " struct" ) != mExtTokens .end ());
1181- Token *classToken = addtoken (tokenList, isStruct ? " struct" : " class" );
1181+ Token * const classToken = addtoken (tokenList, isStruct ? " struct" : " class" );
11821182 std::string className;
11831183 if (mExtTokens [mExtTokens .size () - 2 ] == (isStruct?" struct" :" class" ))
11841184 className = mExtTokens .back ();
11851185 else
11861186 className = mExtTokens [mExtTokens .size () - 2 ];
11871187 className += getTemplateParameters ();
11881188 /* Token *nameToken =*/ addtoken (tokenList, className);
1189+ // base classes
1190+ bool firstBase = true ;
1191+ for (AstNodePtr child: children) {
1192+ if (child->nodeType == " public" || child->nodeType == " protected" || child->nodeType == " private" ) {
1193+ addtoken (tokenList, firstBase ? " :" : " ," );
1194+ addtoken (tokenList, child->nodeType );
1195+ addtoken (tokenList, unquote (child->mExtTokens .back ()));
1196+ firstBase = false ;
1197+ }
1198+ }
1199+ // definition
11891200 if (isDefinition ()) {
11901201 std::vector<AstNodePtr> children2;
11911202 for (AstNodePtr child: children) {
11921203 if (child->nodeType == CXXConstructorDecl ||
11931204 child->nodeType == CXXDestructorDecl ||
11941205 child->nodeType == CXXMethodDecl ||
1195- child->nodeType == FieldDecl)
1206+ child->nodeType == FieldDecl ||
1207+ child->nodeType == VarDecl)
11961208 children2.push_back (child);
11971209 }
11981210 Scope *scope = createScope (tokenList, isStruct ? Scope::ScopeType::eStruct : Scope::ScopeType::eClass, children2, classToken);
@@ -1201,6 +1213,7 @@ void clangimport::AstNode::createTokensForCXXRecord(TokenList *tokenList)
12011213 scope->definedType = &mData ->mSymbolDatabase ->typeList .back ();
12021214 }
12031215 addtoken (tokenList, " ;" );
1216+ const_cast <Token *>(tokenList->back ())->scope (classToken->scope ());
12041217}
12051218
12061219Token * clangimport::AstNode::createTokensVarDecl (TokenList *tokenList)
0 commit comments