njames93 added a comment.
So I wasn't happy with the vagueness of the else after return check
implementation. Almost finished rewriting the check to properly handle the if
statements with condition variables based on scope restrictions and where decls
are used etc.
int *varInitAndCondition() {
if (int *X = g(); X != nullptr) {
return X;
} else {
h(&X);
return X;
}
}
int *varInitAndConditionUnusedInElseWithDecl() {
int *Y = g();
if (int *X = g(); X != nullptr) {
return X;
} else {
int *Y = g();
h(&Y);
}
return Y;
}
transforms to
int *varInitAndCondition() {
int *X = g();
if (X != nullptr) {
return X;
}
h(&X);
return X;
}
int *varInitAndConditionUnusedInElseWithDecl() {
int *Y = g();
if (int *X = g(); X != nullptr) {
return X;
} else {
int *Y = g();
h(&Y);
}
return Y;
}
There's a few more test cases but that's the general idea. I'm having a little
trouble writing the test cases as I can't run them on my windows machine to
verify they report correctly
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71846/new/
https://reviews.llvm.org/D71846
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits