summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-18 07:02:56 +0000
committerChris Lattner <sabre@nondot.org>2007-12-18 07:02:56 +0000
commit78e34a00f49d512f3350a7c1687d0f0cfd520d03 (patch)
treec99941f2226db8e61d343ee4f639cffb73ab12fa
parente2dbba58285ceb674af65aef901ed07e39b7e472 (diff)
downloadbcm5719-llvm-78e34a00f49d512f3350a7c1687d0f0cfd520d03.tar.gz
bcm5719-llvm-78e34a00f49d512f3350a7c1687d0f0cfd520d03.zip
Fix const propagation bug.
llvm-svn: 45152
-rw-r--r--clang/Sema/SemaDecl.cpp3
-rw-r--r--clang/include/clang/AST/Type.h3
2 files changed, 3 insertions, 3 deletions
diff --git a/clang/Sema/SemaDecl.cpp b/clang/Sema/SemaDecl.cpp
index c3b6a8c4d23..c3726725f8f 100644
--- a/clang/Sema/SemaDecl.cpp
+++ b/clang/Sema/SemaDecl.cpp
@@ -601,8 +601,7 @@ bool Sema::CheckInitializer(Expr *&Init, QualType &DeclType, bool isStatic) {
// 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/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 0661f57e690..641e62f1ba5 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -584,7 +584,8 @@ class VariableArrayType : public ArrayType {
: 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;
OpenPOWER on IntegriCloud