File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1473,6 +1473,9 @@ void clangimport::AstNode::createTokensFunctionDecl(TokenList &tokenList)
14731473 AstNodePtr child = children[i];
14741474 if (child->nodeType != ParmVarDecl)
14751475 continue ;
1476+ // there must be a token between the address and the type
1477+ if (child->mExtTokens .size () < 3 )
1478+ throw InternalError (nullptr , " invalid AST node: " + child->nodeType , InternalError::AST );
14761479 if (tokenList.back () != par1)
14771480 addtoken (tokenList, " ," );
14781481 const Type *recordType = addTypeTokens (tokenList, child->mExtTokens .back (), nestedIn);
Original file line number Diff line number Diff line change @@ -1461,6 +1461,10 @@ class TestClangImport : public TestFixture {
14611461 ASSERT_THROW_INTERNAL_EQUALS (parse (" `-CXXConstructorDecl 0x1" ), AST , " invalid AST node: CXXConstructorDecl" );
14621462 ASSERT_THROW_INTERNAL_EQUALS (parse (" `-CXXMethodDecl 0x1" ), AST , " invalid AST node: CXXMethodDecl" );
14631463 ASSERT_THROW_INTERNAL_EQUALS (parse (" `-EnumConstantDecl 0x1" ), AST , " invalid AST node: EnumConstantDecl" );
1464+ ASSERT_THROW_INTERNAL_EQUALS (parse (" `-FunctionDecl 0x1 <a.cpp:1:1, col:20> col:5 f 'int ()'\n "
1465+ " `-ParmVarDecl 0x2 <col:1>\n " ), AST , " invalid AST node: ParmVarDecl" );
1466+ ASSERT_THROW_INTERNAL_EQUALS (parse (" `-FunctionDecl 0x1 <a.cpp:1:1, col:20> col:5 f 'int ()'\n "
1467+ " `-ParmVarDecl 0x2 'int'\n " ), AST , " invalid AST node: ParmVarDecl" );
14641468 }
14651469};
14661470
You can’t perform that action at this time.
0 commit comments