[cfe-commits] r45152 - in /cfe/trunk: Sema/SemaDecl.cpp include/clang/AST/Type.h
Chris Lattner
sabre at nondot.org
Mon Dec 17 23:02:56 PST 2007
Author: lattner
Date: Tue Dec 18 01:02:56 2007
New Revision: 45152
URL: http://llvm.org/viewvc/llvm-project?rev=45152&view=rev
Log:
Fix const propagation bug.
Modified:
cfe/trunk/Sema/SemaDecl.cpp
cfe/trunk/include/clang/AST/Type.h
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=45152&r1=45151&r2=45152&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Tue Dec 18 01:02:56 2007
@@ -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());
Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=45152&r1=45151&r2=45152&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Tue Dec 18 01:02:56 2007
@@ -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;
More information about the cfe-commits
mailing list