Clang import; CXXThrowExpr
This commit is contained in:
parent
549df6a80e
commit
7fecc17707
|
@ -53,6 +53,7 @@ static const std::string CXXRecordDecl = "CXXRecordDecl";
|
||||||
static const std::string CXXStaticCastExpr = "CXXStaticCastExpr";
|
static const std::string CXXStaticCastExpr = "CXXStaticCastExpr";
|
||||||
static const std::string CXXTemporaryObjectExpr = "CXXTemporaryObjectExpr";
|
static const std::string CXXTemporaryObjectExpr = "CXXTemporaryObjectExpr";
|
||||||
static const std::string CXXThisExpr = "CXXThisExpr";
|
static const std::string CXXThisExpr = "CXXThisExpr";
|
||||||
|
static const std::string CXXThrowExpr = "CXXThrowExpr";
|
||||||
static const std::string DeclRefExpr = "DeclRefExpr";
|
static const std::string DeclRefExpr = "DeclRefExpr";
|
||||||
static const std::string DeclStmt = "DeclStmt";
|
static const std::string DeclStmt = "DeclStmt";
|
||||||
static const std::string DoStmt = "DoStmt";
|
static const std::string DoStmt = "DoStmt";
|
||||||
|
@ -659,6 +660,11 @@ Token *clangimport::AstNode::createTokens(TokenList *tokenList)
|
||||||
return children[0]->createTokens(tokenList);
|
return children[0]->createTokens(tokenList);
|
||||||
if (nodeType == CXXThisExpr)
|
if (nodeType == CXXThisExpr)
|
||||||
return addtoken(tokenList, "this");
|
return addtoken(tokenList, "this");
|
||||||
|
if (nodeType == CXXThrowExpr) {
|
||||||
|
Token *t = addtoken(tokenList, "throw");
|
||||||
|
t->astOperand1(children[0]->createTokens(tokenList));
|
||||||
|
return t;
|
||||||
|
}
|
||||||
if (nodeType == DeclRefExpr) {
|
if (nodeType == DeclRefExpr) {
|
||||||
const std::string addr = mExtTokens[mExtTokens.size() - 3];
|
const std::string addr = mExtTokens[mExtTokens.size() - 3];
|
||||||
std::string name = unquote(getSpelling());
|
std::string name = unquote(getSpelling());
|
||||||
|
|
|
@ -53,6 +53,7 @@ private:
|
||||||
TEST_CASE(cxxRecordDecl1);
|
TEST_CASE(cxxRecordDecl1);
|
||||||
TEST_CASE(cxxStaticCastExpr1);
|
TEST_CASE(cxxStaticCastExpr1);
|
||||||
TEST_CASE(cxxStaticCastExpr2);
|
TEST_CASE(cxxStaticCastExpr2);
|
||||||
|
TEST_CASE(cxxThrowExpr);
|
||||||
TEST_CASE(doStmt);
|
TEST_CASE(doStmt);
|
||||||
TEST_CASE(forStmt);
|
TEST_CASE(forStmt);
|
||||||
TEST_CASE(funcdecl1);
|
TEST_CASE(funcdecl1);
|
||||||
|
@ -409,6 +410,14 @@ private:
|
||||||
ASSERT_EQUALS("int a@1 = static_cast<structstd::_Rb_tree_iterator<structstd::pair<constclassstd::__cxx11::basic_string<char>,structLibrary::AllocFunc>>&&> ( <NoName> ) ;", parse(clang));
|
ASSERT_EQUALS("int a@1 = static_cast<structstd::_Rb_tree_iterator<structstd::pair<constclassstd::__cxx11::basic_string<char>,structLibrary::AllocFunc>>&&> ( <NoName> ) ;", 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"
|
||||||
|
" `-CXXThrowExpr 0x3701790 <col:14, col:20> 'void'\n"
|
||||||
|
" `-IntegerLiteral 0x3701770 <col:20> 'int' 1";
|
||||||
|
ASSERT_EQUALS("void foo ( ) { throw 1 ; }", parse(clang));
|
||||||
|
}
|
||||||
|
|
||||||
void doStmt() {
|
void doStmt() {
|
||||||
const char clang[] = "`-FunctionDecl 0x27fbbc8 <line:2:1, col:34> col:6 foo 'void ()'\n"
|
const char clang[] = "`-FunctionDecl 0x27fbbc8 <line:2:1, col:34> col:6 foo 'void ()'\n"
|
||||||
" `-CompoundStmt 0x27fbd08 <col:12, col:34>\n"
|
" `-CompoundStmt 0x27fbd08 <col:12, col:34>\n"
|
||||||
|
|
Loading…
Reference in New Issue