]> granicus.if.org Git - clang/commitdiff
[AST] Fix an use-of-uninitialized bug introduced in CaseStmt
authorBruno Ricci <riccibrun@gmail.com>
Sun, 28 Oct 2018 14:14:06 +0000 (14:14 +0000)
committerBruno Ricci <riccibrun@gmail.com>
Sun, 28 Oct 2018 14:14:06 +0000 (14:14 +0000)
SwitchCaseBits.CaseStmtIsGNURange needs to be initialized first.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345477 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Stmt.h

index 3cdd48fca2f7ef9ccf6772d916b76d656609149e..3172c706d1eea4c4a296f18305efadea8fcdd277 100644 (file)
@@ -975,11 +975,11 @@ class CaseStmt final
   CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc,
            SourceLocation ellipsisLoc, SourceLocation colonLoc)
       : SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
-    setLHS(lhs);
-    setSubStmt(nullptr);
     // Handle GNU case statements of the form LHS ... RHS.
     bool IsGNURange = rhs != nullptr;
     SwitchCaseBits.CaseStmtIsGNURange = IsGNURange;
+    setLHS(lhs);
+    setSubStmt(nullptr);
     if (IsGNURange) {
       setRHS(rhs);
       setEllipsisLoc(ellipsisLoc);