clang import: try to handle CXXFunctionalCastExpr
This commit is contained in:
parent
770bd6cb73
commit
1f8896e51c
|
@ -48,6 +48,7 @@ static const std::string CXXDefaultArgExpr = "CXXDefaultArgExpr";
|
|||
static const std::string CXXDeleteExpr = "CXXDeleteExpr";
|
||||
static const std::string CXXDestructorDecl = "CXXDestructorDecl";
|
||||
static const std::string CXXForRangeStmt = "CXXForRangeStmt";
|
||||
static const std::string CXXFunctionalCastExpr = "CXXFunctionalCastExpr";
|
||||
static const std::string CXXMemberCallExpr = "CXXMemberCallExpr";
|
||||
static const std::string CXXMethodDecl = "CXXMethodDecl";
|
||||
static const std::string CXXNewExpr = "CXXNewExpr";
|
||||
|
@ -712,7 +713,7 @@ Token *clangimport::AstNode::createTokens(TokenList *tokenList)
|
|||
createTokensForCXXRecord(tokenList);
|
||||
return nullptr;
|
||||
}
|
||||
if (nodeType == CXXStaticCastExpr) {
|
||||
if (nodeType == CXXStaticCastExpr || nodeType == CXXFunctionalCastExpr) {
|
||||
Token *cast = addtoken(tokenList, getSpelling());
|
||||
Token *par1 = addtoken(tokenList, "(");
|
||||
Token *expr = children[0]->createTokens(tokenList);
|
||||
|
|
|
@ -50,6 +50,7 @@ private:
|
|||
TEST_CASE(cxxDestructorDecl);
|
||||
TEST_CASE(cxxForRangeStmt1);
|
||||
TEST_CASE(cxxForRangeStmt2);
|
||||
TEST_CASE(cxxFunctionalCastExpr);
|
||||
TEST_CASE(cxxMemberCall);
|
||||
TEST_CASE(cxxMethodDecl1);
|
||||
TEST_CASE(cxxMethodDecl2);
|
||||
|
@ -433,6 +434,24 @@ private:
|
|||
parse(clang));
|
||||
}
|
||||
|
||||
void cxxFunctionalCastExpr() {
|
||||
const char clang[] = "`-FunctionDecl 0x156fe98 <line:1:1, line:3:1> line:1:5 main 'int (int, char **)'\n"
|
||||
" |-ParmVarDecl 0x156fd00 <col:10, col:14> col:14 argc 'int'\n"
|
||||
" |-ParmVarDecl 0x156fdb8 <col:20, col:27> col:27 argv 'char **'\n"
|
||||
" `-CompoundStmt 0x1596410 <line:2:1, line:2:1>\n"
|
||||
" |-DeclStmt 0x15946a8 <line:2:15, line:2:29>\n"
|
||||
" | `-VarDecl 0x1570118 <line:2:15, line:2:28> col:11 used setCode 'MyVar<int>':'MyVar<int>' cinit\n"
|
||||
" | `-ExprWithCleanups 0x1594690 <line:2:15, line:3:28> 'MyVar<int>':'MyVar<int>'\n"
|
||||
" | `-CXXConstructExpr 0x1594660 <line:2:15, line:3:28> 'MyVar<int>':'MyVar<int>' 'void (MyVar<int> &&) noexcept' elidable\n"
|
||||
" | `-MaterializeTemporaryExpr 0x1592b68 <line:2:15, line:3:28> 'MyVar<int>':'MyVar<int>' xvalue\n"
|
||||
" | `-CXXFunctionalCastExpr 0x1592b40 <line:2:15, line:3:28> 'MyVar<int>':'MyVar<int>' functional cast to MyVar<int> <ConstructorConversion>\n"
|
||||
" | `-CXXConstructExpr 0x15929f0 <line:2:15, line:3:28> 'MyVar<int>':'MyVar<int>' 'void (int)'\n"
|
||||
" | `-IntegerLiteral 0x1570248 <col:27> 'int' 5\n";
|
||||
ASSERT_EQUALS("int main ( int argc@1 , char ** argv@2 ) {\n"
|
||||
"MyVar<int> setCode@3 = MyVar<int> ( 5 ) ; }",
|
||||
parse(clang));
|
||||
}
|
||||
|
||||
void cxxMemberCall() {
|
||||
const char clang[] = "`-FunctionDecl 0x320dc80 <line:2:1, col:33> col:6 bar 'void ()'\n"
|
||||
" `-CompoundStmt 0x323bb08 <col:12, col:33>\n"
|
||||
|
|
Loading…
Reference in New Issue