================
@@ -971,6 +972,34 @@ StmtResult Sema::ActOnIfStmt(SourceLocation IfLoc,
   if (!ConstevalOrNegatedConsteval && !elseStmt)
     DiagnoseEmptyStmtBody(RParenLoc, thenStmt, diag::warn_empty_if_body);
 
+  // Checks for if/else-if condition variable usage in else-if/else scope
+  if (elseStmt) {
+    VarDecl *ConditionVar = nullptr;
+
+    if (auto *CondVar = Cond.get().first) {
+      ConditionVar = dyn_cast<VarDecl>(CondVar);
+    }    
+
+    if (ConditionVar) {
+      struct ElseVariableUsageChecker
+        : public RecursiveASTVisitor<ElseVariableUsageChecker> {
----------------
Sirraide wrote:

I should do another pass and migrate any visitors that may have been introduced 
in the meantime or are still left unmigrated

https://github.com/llvm/llvm-project/pull/156436
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to