Clang import; Function declaration

This commit is contained in:
Daniel Marjamäki 2020-12-30 17:00:05 +01:00
parent f986b37a50
commit a1756f3afc
2 changed files with 9 additions and 0 deletions

View File

@ -515,6 +515,8 @@ const ::Type * clangimport::AstNode::addTypeTokens(TokenList *tokenList, const s
type.erase(type.find("(*)("));
type += "*";
}
if (type.find("(") != std::string::npos)
type.erase(type.find("("));
std::stack<Token *> lpar;
for (const std::string &s: splitString(type)) {

View File

@ -81,6 +81,7 @@ private:
TEST_CASE(funcdecl3);
TEST_CASE(funcdecl4);
TEST_CASE(funcdecl5);
TEST_CASE(funcdecl6);
TEST_CASE(functionTemplateDecl1);
TEST_CASE(functionTemplateDecl2);
TEST_CASE(initListExpr);
@ -764,6 +765,12 @@ private:
ASSERT_EQUALS("static inline void foo ( ) ;", parse(clang));
}
void funcdecl6() {
const char clang[] = "`-FunctionDecl 0x196eea8 <1.cpp:3:5, col:27> col:12 foo 'void **(int)'\n"
" `-ParmVarDecl 0x196eda0 <col:17, col:21> col:21 count 'int'";
ASSERT_EQUALS("void * * foo ( int count@1 ) ;", parse(clang));
}
void functionTemplateDecl1() {
const char clang[] = "`-FunctionTemplateDecl 0x3242860 <a.cpp:1:1, col:46> col:21 foo";
ASSERT_EQUALS("", parse(clang));