[PATCH] D71846: [ASTMatchers] Fix for https://bugs.llvm.org/show_bug.cgi?id=44364
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 26 13:11:05 PST 2019
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
More information about the cfe-commits
mailing list