================
@@ -1526,6 +1526,44 @@ StmtResult Parser::ParseIfStatement(SourceLocation
*TrailingElseLoc) {
SourceLocation ElseStmtLoc;
StmtResult ElseStmt;
+ static llvm::DenseMap<const IdentifierInfo*, SourceLocation> UsedCondVars;
----------------
Sirraide wrote:
You can’t use static local variables for this; this has to be a class member
somewhere. Additionally, you have to store the actual variable declaration and
not just its name; otherwise, this is not going to do the right think for cases
such as
```c++
void f() {
if (bool x = foo()) {}
else {
{
bool x = foo();
if (x) {} // Should not warn here since this is a different
variable.
}
}
}
```
https://github.com/llvm/llvm-project/pull/156436
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits