diff --git a/lib/clangastdump.cpp b/lib/clangastdump.cpp index ebe88bf1c..742294716 100644 --- a/lib/clangastdump.cpp +++ b/lib/clangastdump.cpp @@ -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; diff --git a/test/testclangastdump.cpp b/test/testclangastdump.cpp index fdd0dbc02..c352357cd 100644 --- a/test/testclangastdump.cpp +++ b/test/testclangastdump.cpp @@ -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 col:6 x 'bool' cinit\n" + " `-CXXBoolLiteralExpr 0x39406a8 'bool' true"; + ASSERT_EQUALS("bool x@1 = true ;", parse(clang)); + } + void cxxConstructorDecl() { const char clang[] = "|-CXXConstructorDecl 0x428e890 col:11 C 'void ()'\n" "| `-CompoundStmt 0x428ea58 \n"