Clang import; CXXBoolLiteralExpr

This commit is contained in:
Daniel Marjamäki 2020-01-09 16:19:23 +01:00
parent 9d8f67a6ca
commit fea981211e
2 changed files with 13 additions and 0 deletions

View File

@ -34,6 +34,7 @@ static const std::string ClassTemplateDecl = "ClassTemplateDecl";
static const std::string ClassTemplateSpecializationDecl = "ClassTemplateSpecializationDecl";
static const std::string CompoundStmt = "CompoundStmt";
static const std::string ContinueStmt = "ContinueStmt";
static const std::string CXXBoolLiteralExpr = "CXXBoolLiteralExpr";
static const std::string CXXConstructorDecl = "CXXConstructorDecl";
static const std::string CXXMemberCallExpr = "CXXMemberCallExpr";
static const std::string CXXMethodDecl = "CXXMethodDecl";
@ -389,6 +390,11 @@ Token *clangastdump::AstNode::createTokens(TokenList *tokenList)
createTokensFunctionDecl(tokenList);
return nullptr;
}
if (nodeType == CXXBoolLiteralExpr) {
addtoken(tokenList, mExtTokens.back());
tokenList->back()->setValueType(new ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::BOOL, 0));
return tokenList->back();
}
if (nodeType == CXXMethodDecl) {
createTokensFunctionDecl(tokenList);
return nullptr;

View File

@ -34,6 +34,7 @@ private:
TEST_CASE(classTemplateDecl1);
TEST_CASE(classTemplateDecl2);
TEST_CASE(continueStmt);
TEST_CASE(cxxBoolLiteralExpr);
TEST_CASE(cxxConstructorDecl);
TEST_CASE(cxxMemberCall);
TEST_CASE(cxxOperatorCallExpr);
@ -163,6 +164,12 @@ private:
ASSERT_EQUALS("void foo ( ) { while ( 0 ) { continue ; } }", parse(clang));
}
void cxxBoolLiteralExpr() {
const char clang[] = "`-VarDecl 0x3940608 <a.cpp:1:1, col:10> col:6 x 'bool' cinit\n"
" `-CXXBoolLiteralExpr 0x39406a8 <col:10> 'bool' true";
ASSERT_EQUALS("bool x@1 = true ;", parse(clang));
}
void cxxConstructorDecl() {
const char clang[] = "|-CXXConstructorDecl 0x428e890 <col:11, col:24> col:11 C 'void ()'\n"
"| `-CompoundStmt 0x428ea58 <col:15, col:24>\n"