[PATCH] D82310: Add `BoolLiteralExpression` to SyntaxTree
Eduardo Caldas via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 23 01:00:59 PDT 2020
eduucaldas marked an inline comment as done.
eduucaldas added inline comments.
================
Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:1240
+ true;
+ false;
+}
----------------
gribozavr2 wrote:
> C99 has bool literals, but the program should include stdbool.h.
>
> I feel like it is better to make the predicate something like "hasBoolType()" and change the test to include stdbool.h.
[[ https://clang.llvm.org/doxygen/stdbool_8h_source.html | stdbool ]] consists on macro definitions, mapping booleans to integers. `true` is preprocessed into 1 and `false` to 0 .
I don't think there is a reasonable way of getting the proper SyntaxTree from that macro expansion
Additional problem, we don't have the test infrastructure for includes, AFAIK ^^
Finally, regarding the predicates, I prefer if they relate to languages, otherwise we might create many predicates that test for exactly the same thing, e.g. we would have `hasBoolType()` and `hasNullPtr()` that ultimately do the same thing, test if Language is not C
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82310/new/
https://reviews.llvm.org/D82310
More information about the cfe-commits
mailing list