================
@@ -13660,10 +13594,11 @@ def warn_acc_var_referenced_lacks_op
"reference has no effect">,
InGroup<DiagGroup<"openacc-var-lacks-operation">>,
DefaultError;
+def warn_out_of_scope_var_usage
+ : Warning<"variable %0 declared in 'if' block is always false or null
here">,
+ InGroup<DiagGroup<"conditional-scope">>;
----------------
arrowten wrote:
@erichkeane Correct me if I am wrong.
In here, this is the current scenario
```
if (int *ptr = get_something()) {
return ptr[0];
}
else if (int *ptr2 = get_something_else()) {
return ptr[0] * ptr2[0]; //warns for ptr
}
else if (int *ptr3 = get_something_else_again()) {
return ptr[0] * ptr2[0] * ptr3[0]; // warns for ptr and ptr2
}
else if (int *ptr4 = get_something_else_again_now()) {
return ptr[0] * ptr2[0] * ptr3[0] * ptr4[0]; // warns for ptr, ptr2
and ptr3
}
```
It should warn for something else too?
https://github.com/llvm/llvm-project/pull/156436
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits