Clang import; forward class declaration

This commit is contained in:
Daniel Marjamäki 2020-01-11 15:58:31 +01:00
parent 00e017722f
commit 05a34142aa
2 changed files with 8 additions and 1 deletions

View File

@ -533,7 +533,8 @@ Token *clangimport::AstNode::createTokens(TokenList *tokenList)
if (nodeType == CXXOperatorCallExpr)
return createTokensCall(tokenList);
if (nodeType == CXXRecordDecl) {
createTokensForCXXRecord(tokenList);
if (!children.empty())
createTokensForCXXRecord(tokenList);
return nullptr;
}
if (nodeType == CXXStaticCastExpr) {

View File

@ -43,6 +43,7 @@ private:
TEST_CASE(cxxMemberCall);
TEST_CASE(cxxNullPtrLiteralExpr);
TEST_CASE(cxxOperatorCallExpr);
TEST_CASE(cxxRecordDecl1);
TEST_CASE(cxxStaticCastExpr1);
TEST_CASE(cxxStaticCastExpr2);
TEST_CASE(forStmt);
@ -255,6 +256,11 @@ private:
ASSERT_EQUALS("void foo ( ) { C c@1 ; c@1 . operator= ( 4 ) ; }", parse(clang));
}
void cxxRecordDecl1() {
const char clang[] = "`-CXXRecordDecl 0x34cc5f8 <1.cpp:2:1, col:7> col:7 class Foo";
ASSERT_EQUALS("", parse(clang));
}
void cxxStaticCastExpr1() {
const char clang[] = "`-VarDecl 0x2e0e650 <a.cpp:2:1, col:27> col:5 a 'int' cinit\n"
" `-CXXStaticCastExpr 0x2e0e728 <col:9, col:27> 'int' static_cast<int> <NoOp>\n"