[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.

llvm-svn: 345477

clang/include/clang/AST/Stmt.h

index 3cdd48f..3172c70 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);