Clang import; CXXNullPtrLiteralExpr
This commit is contained in:
parent
7a3bedb583
commit
30bc67c691
|
@ -41,6 +41,7 @@ static const std::string CXXConstructorDecl = "CXXConstructorDecl";
|
||||||
static const std::string CXXConstructExpr = "CXXConstructExpr";
|
static const std::string CXXConstructExpr = "CXXConstructExpr";
|
||||||
static const std::string CXXMemberCallExpr = "CXXMemberCallExpr";
|
static const std::string CXXMemberCallExpr = "CXXMemberCallExpr";
|
||||||
static const std::string CXXMethodDecl = "CXXMethodDecl";
|
static const std::string CXXMethodDecl = "CXXMethodDecl";
|
||||||
|
static const std::string CXXNullPtrLiteralExpr = "CXXNullPtrLiteralExpr";
|
||||||
static const std::string CXXOperatorCallExpr = "CXXOperatorCallExpr";
|
static const std::string CXXOperatorCallExpr = "CXXOperatorCallExpr";
|
||||||
static const std::string CXXRecordDecl = "CXXRecordDecl";
|
static const std::string CXXRecordDecl = "CXXRecordDecl";
|
||||||
static const std::string CXXStaticCastExpr = "CXXStaticCastExpr";
|
static const std::string CXXStaticCastExpr = "CXXStaticCastExpr";
|
||||||
|
@ -514,6 +515,8 @@ Token *clangimport::AstNode::createTokens(TokenList *tokenList)
|
||||||
}
|
}
|
||||||
if (nodeType == CXXMemberCallExpr)
|
if (nodeType == CXXMemberCallExpr)
|
||||||
return createTokensCall(tokenList);
|
return createTokensCall(tokenList);
|
||||||
|
if (nodeType == CXXNullPtrLiteralExpr)
|
||||||
|
return addtoken(tokenList, "nullptr");
|
||||||
if (nodeType == CXXOperatorCallExpr)
|
if (nodeType == CXXOperatorCallExpr)
|
||||||
return createTokensCall(tokenList);
|
return createTokensCall(tokenList);
|
||||||
if (nodeType == CXXRecordDecl) {
|
if (nodeType == CXXRecordDecl) {
|
||||||
|
|
|
@ -40,6 +40,7 @@ private:
|
||||||
TEST_CASE(cxxConstructorDecl);
|
TEST_CASE(cxxConstructorDecl);
|
||||||
TEST_CASE(cxxConstructExpr);
|
TEST_CASE(cxxConstructExpr);
|
||||||
TEST_CASE(cxxMemberCall);
|
TEST_CASE(cxxMemberCall);
|
||||||
|
TEST_CASE(cxxNullPtrLiteralExpr);
|
||||||
TEST_CASE(cxxOperatorCallExpr);
|
TEST_CASE(cxxOperatorCallExpr);
|
||||||
TEST_CASE(cxxStaticCastExpr1);
|
TEST_CASE(cxxStaticCastExpr1);
|
||||||
TEST_CASE(cxxStaticCastExpr2);
|
TEST_CASE(cxxStaticCastExpr2);
|
||||||
|
@ -224,6 +225,13 @@ private:
|
||||||
ASSERT_EQUALS("void bar ( ) { C<int> c@1 ; c@1 . foo ( ) ; }", parse(clang));
|
ASSERT_EQUALS("void bar ( ) { C<int> c@1 ; c@1 . foo ( ) ; }", parse(clang));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cxxNullPtrLiteralExpr() {
|
||||||
|
const char clang[] = "`-VarDecl 0x2a7d650 <1.cpp:1:1, col:17> col:13 p 'const char *' cinit\n"
|
||||||
|
" `-ImplicitCastExpr 0x2a7d708 <col:17> 'const char *' <NullToPointer>\n"
|
||||||
|
" `-CXXNullPtrLiteralExpr 0x2a7d6f0 <col:17> 'nullptr_t'";
|
||||||
|
ASSERT_EQUALS("const char * p@1 = nullptr ;", parse(clang));
|
||||||
|
}
|
||||||
|
|
||||||
void cxxOperatorCallExpr() {
|
void cxxOperatorCallExpr() {
|
||||||
const char clang[] = "`-FunctionDecl 0x3c099f0 <line:2:1, col:24> col:6 foo 'void ()'\n"
|
const char clang[] = "`-FunctionDecl 0x3c099f0 <line:2:1, col:24> col:6 foo 'void ()'\n"
|
||||||
" `-CompoundStmt 0x3c37308 <col:12, col:24>\n"
|
" `-CompoundStmt 0x3c37308 <col:12, col:24>\n"
|
||||||
|
|
Loading…
Reference in New Issue