[clang] 507108e - [clang] Fix enum/non-enum conditional warning in ParseStmt (#207085)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 2 07:41:38 PDT 2026


Author: disservin
Date: 2026-07-02T14:41:33Z
New Revision: 507108edb62722b0f8bebf11133722d6689c0b65

URL: https://github.com/llvm/llvm-project/commit/507108edb62722b0f8bebf11133722d6689c0b65
DIFF: https://github.com/llvm/llvm-project/commit/507108edb62722b0f8bebf11133722d6689c0b65.diff

LOG: [clang] Fix enum/non-enum conditional warning in ParseStmt (#207085)

Use Scope::NoScope instead of 0, fixes
```
llvm-project/clang/lib/Parse/ParseStmt.cpp:1744:57: warning: enumerated and non-enumerated type in conditional expression [-Wextra]
 1744 |   unsigned ScopeFlags = Scope::ControlScope | (C99orCXX ? Scope::DeclScope : 0);
```

Added: 
    

Modified: 
    clang/lib/Parse/ParseStmt.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index 37f142e059930..f9c7d0988b403 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -1741,7 +1741,8 @@ StmtResult Parser::ParseWhileStatement(SourceLocation *TrailingElseLoc,
   // while, for, and switch statements are local to the if, while, for, or
   // switch statement (including the controlled statement).
   //
-  unsigned ScopeFlags = Scope::ControlScope | (C99orCXX ? Scope::DeclScope : 0);
+  unsigned ScopeFlags =
+      Scope::ControlScope | (C99orCXX ? Scope::DeclScope : Scope::NoScope);
   ParseScope WhileScope(this, ScopeFlags);
 
   // Parse the condition.


        


More information about the cfe-commits mailing list