Fix const propagation bug.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45152 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index c3b6a8c..c372672 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -601,8 +601,7 @@
   // C99 6.7.8p3: The type of the entity to be initialized shall be an array
   // of unknown size ("[]") or an object type that is not a variable array type.
   if (const VariableArrayType *VAT = DeclType->getAsVariableArrayType()) { 
-    Expr *expr = VAT->getSizeExpr();
-    if (expr)
+    if (const Expr *expr = VAT->getSizeExpr())
       return Diag(expr->getLocStart(), diag::err_variable_object_no_init, 
                   expr->getSourceRange());
 
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index 0661f57..641e62f 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -584,7 +584,8 @@
     : ArrayType(VariableArray, et, can, sm, tq), SizeExpr(e) {}
   friend class ASTContext;  // ASTContext creates these.
 public:
-  Expr *getSizeExpr() const { return SizeExpr; }
+  const Expr *getSizeExpr() const { return SizeExpr; }
+  Expr *getSizeExpr() { return SizeExpr; }
   
   virtual void getAsStringInternal(std::string &InnerString) const;