[cfe-dev] bool type is represented as "_Bool" in the AST
Stephen Kelly via cfe-dev
cfe-dev at lists.llvm.org
Tue Jul 23 10:30:49 PDT 2019
I noticed that too recently:
$ cat f.cmds
set print-matcher true
m functionDecl(returns(asString("int")))
m functionDecl(returns(asString("bool")))
m functionDecl(returns(asString("_Bool")))
$ cat foo.cpp
int foo();
bool bar();
$ clang-query -f f.cmds foo.cpp -- -std=c++17
Matcher: functionDecl(returns(asString("int")))
===============================================
Match #1:
foo.cpp:2:1: note: "root" binds here
int foo();
^~~~~~~~~
1 match.
Matcher: functionDecl(returns(asString("bool")))
================================================
0 matches.
Matcher: functionDecl(returns(asString("_Bool")))
=================================================
Match #1:
foo.cpp:4:1: note: "root" binds here
bool bar();
^~~~~~~~~~
1 match.
$
I don't know any more than that.
Thanks,
Stephen.
On 23/07/2019 15:47, Pradeep Kumar via cfe-dev wrote:
> Dear Clang-developer community,
> I am using libTooling to query information about the source. While
> querying the string representation of the bool type, I get "_Bool"
> string. I got the string from QualType::getAsString(). Should I be using
> another function to query the actual type or is it an expected behavior?
>
> I don't get _Bool when dumping the ast except when I dump the
> QualType Node.
>
> clang Version: 9.0
> LLVM Version: 9.0
>
> Regards,
> Pradeep
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
More information about the cfe-dev
mailing list