This revision was automatically updated to reflect the committed changes.
Closed by commit rL276076: [Sema] Compute the nullability of a conditional
expression based on the (authored by ahatanak).
Changed prior to commit:
https://reviews.llvm.org/D22392?vs=64557=64628#toc
Repository:
rL
doug.gregor accepted this revision.
doug.gregor added a comment.
This revision is now accepted and ready to land.
LGTM!
https://reviews.llvm.org/D22392
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
ahatanak updated this revision to Diff 64557.
ahatanak added a comment.
Remove the check "if (LHSKind == RHSKind)" in computeConditionalNullability as
it's not needed.
https://reviews.llvm.org/D22392
Files:
lib/Sema/SemaExpr.cpp
test/Sema/nullability.c
test/SemaCXX/nullability.cpp
ahatanak updated this revision to Diff 64551.
ahatanak added a comment.
Address review comments.
- Rename function to computeConditionalNullability.
- Rewrite the function to compute the nullability of both normal and binary
conditional expressions.
- Add more test cases.
ahatanak added a comment.
I'm thinking about taking the following steps to compute the nullability of
ternary operators.
The first step is to compute the "merged" nullability of the LHS and RHS.
For normal ternary operators (not the shorthand version):
- If both LHS and RHS have the same
ahatanak added inline comments.
Comment at: lib/Sema/SemaExpr.cpp:7007
@@ +7006,3 @@
+/// expression.
+static QualType modifyNullability(QualType ResTy, Expr *RHSExpr,
+ ASTContext ) {
doug.gregor wrote:
> This name could be
doug.gregor added a comment.
A bunch of comments above. This needs much more extensive testing, because
there are numerous paths through the ternary operator code and the results need
to be symmetric.
Comment at: lib/Sema/SemaExpr.cpp:7007
@@ +7006,3 @@
+/// expression.
ahatanak updated this revision to Diff 64077.
ahatanak added a comment.
Remove unused variable.
https://reviews.llvm.org/D22392
Files:
lib/Sema/SemaExpr.cpp
test/Sema/nullability.c
Index: test/Sema/nullability.c
===
---
ahatanak created this revision.
ahatanak added a reviewer: doug.gregor.
ahatanak added a subscriber: cfe-commits.
Currently clang issues a warning when the following code using a shorthand form
of the conditional operator is compiled:
$ cat test1.c
```
void foo() {
int * _Nullable p0;
int *