[cfe-dev] Why is canonical type _Bool instead of bool?

Ray Zhang via cfe-dev cfe-dev at lists.llvm.org
Wed Oct 14 02:35:42 PDT 2020


Hi,

When canonicalizing bools, the resulting value is equal to _Bool(which is a
C99 thing). The tool I'm developing is turning expressions such as

(bool) 3.2f;

into:

static_cast<_Bool>(3.2f);

Is there some way I can set this to not be the case when parsing C++ files?
The closest thing that seemed to make sense was to set language options
<https://clang.llvm.org/doxygen/classclang_1_1LangOptions.html> but I don't
see where I can explicitly only support C++.

Best,
Ray Zhang

P.S. I'm fairly close to finishing the entire tool and am hoping to
contribute it into clang-tools-extra :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20201014/beec6dba/attachment.html>


More information about the cfe-dev mailing list