Clang import; CXXStdInitializerListExpr
This commit is contained in:
parent
a20b3a9e2e
commit
b6db5116c3
|
@ -53,6 +53,7 @@ static const std::string CXXNullPtrLiteralExpr = "CXXNullPtrLiteralExpr";
|
|||
static const std::string CXXOperatorCallExpr = "CXXOperatorCallExpr";
|
||||
static const std::string CXXRecordDecl = "CXXRecordDecl";
|
||||
static const std::string CXXStaticCastExpr = "CXXStaticCastExpr";
|
||||
static const std::string CXXStdInitializerListExpr = "CXXStdInitializerListExpr";
|
||||
static const std::string CXXTemporaryObjectExpr = "CXXTemporaryObjectExpr";
|
||||
static const std::string CXXThisExpr = "CXXThisExpr";
|
||||
static const std::string CXXThrowExpr = "CXXThrowExpr";
|
||||
|
@ -680,6 +681,8 @@ Token *clangimport::AstNode::createTokens(TokenList *tokenList)
|
|||
setValueType(par1);
|
||||
return par1;
|
||||
}
|
||||
if (nodeType == CXXStdInitializerListExpr)
|
||||
return children[0]->createTokens(tokenList);
|
||||
if (nodeType == CXXTemporaryObjectExpr && !children.empty())
|
||||
return children[0]->createTokens(tokenList);
|
||||
if (nodeType == CXXThisExpr)
|
||||
|
@ -1071,6 +1074,8 @@ Token * clangimport::AstNode::createTokensVarDecl(TokenList *tokenList)
|
|||
par1->link(par2);
|
||||
par2->link(par1);
|
||||
return par1;
|
||||
} else if (mExtTokens.back() == "listinit") {
|
||||
return children[0]->createTokens(tokenList);
|
||||
}
|
||||
return vartok1;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ private:
|
|||
TEST_CASE(cxxRecordDecl1);
|
||||
TEST_CASE(cxxStaticCastExpr1);
|
||||
TEST_CASE(cxxStaticCastExpr2);
|
||||
TEST_CASE(cxxStdInitializerListExpr);
|
||||
TEST_CASE(cxxThrowExpr);
|
||||
TEST_CASE(doStmt);
|
||||
TEST_CASE(forStmt);
|
||||
|
@ -450,6 +451,20 @@ private:
|
|||
ASSERT_EQUALS("int a@1 = static_cast<structstd::_Rb_tree_iterator<structstd::pair<constclassstd::__cxx11::basic_string<char>,structLibrary::AllocFunc>>&&> ( <NoName> ) ;", parse(clang));
|
||||
}
|
||||
|
||||
void cxxStdInitializerListExpr() {
|
||||
const char clang[] = "`-VarDecl 0x2f92060 <1.cpp:3:1, col:25> col:18 x 'std::vector<int>':'std::vector<int, std::allocator<int> >' listinit\n"
|
||||
" `-ExprWithCleanups 0x2fb0b40 <col:18, col:25> 'std::vector<int>':'std::vector<int, std::allocator<int> >'\n"
|
||||
" `-CXXConstructExpr 0x2fb0b00 <col:18, col:25> 'std::vector<int>':'std::vector<int, std::allocator<int> >' 'void (initializer_list<std::vector<int, std::allocator<int> >::value_type>, const std::vector<int, std::allocator<int> >::allocator_type &)' list std::initializer_list\n"
|
||||
" |-CXXStdInitializerListExpr 0x2fb0928 <col:19, col:25> 'initializer_list<std::vector<int, std::allocator<int> >::value_type>':'std::initializer_list<int>'\n"
|
||||
" | `-MaterializeTemporaryExpr 0x2fb0910 <col:19, col:25> 'const int [3]' xvalue\n"
|
||||
" | `-InitListExpr 0x2fb08b8 <col:19, col:25> 'const int [3]'\n"
|
||||
" | |-IntegerLiteral 0x2f920c0 <col:20> 'int' 1\n"
|
||||
" | |-IntegerLiteral 0x2f920e0 <col:22> 'int' 2\n"
|
||||
" | `-IntegerLiteral 0x2f92100 <col:24> 'int' 3\n"
|
||||
" `-CXXDefaultArgExpr 0x2fb0ae0 <<invalid sloc>> 'const std::vector<int, std::allocator<int> >::allocator_type':'const std::allocator<int>' lvalue";
|
||||
ASSERT_EQUALS("std::vector<int> x@1 { 1 , 2 , 3 } ;", parse(clang));
|
||||
}
|
||||
|
||||
void cxxThrowExpr() {
|
||||
const char clang[] = "`-FunctionDecl 0x3701690 <1.cpp:2:1, col:23> col:6 foo 'void ()'\n"
|
||||
" `-CompoundStmt 0x37017b0 <col:12, col:23>\n"
|
||||
|
|
Loading…
Reference in New Issue