[cfe-commits] r45153 - /cfe/trunk/AST/Type.cpp
Chris Lattner
sabre at nondot.org
Mon Dec 17 23:03:31 PST 2007
Author: lattner
Date: Tue Dec 18 01:03:30 2007
New Revision: 45153
URL: http://llvm.org/viewvc/llvm-project?rev=45153&view=rev
Log:
Fix PR1863: an assertion due to not setting a location on return from
this method.
Modified:
cfe/trunk/AST/Type.cpp
Modified: cfe/trunk/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Type.cpp?rev=45153&r1=45152&r2=45153&view=diff
==============================================================================
--- cfe/trunk/AST/Type.cpp (original)
+++ cfe/trunk/AST/Type.cpp Tue Dec 18 01:03:30 2007
@@ -449,9 +449,13 @@
// The only variable size types are auto arrays within a function. Structures
// cannot contain a VLA member. They can have a flexible array member, however
// the structure is still constant size (C99 6.7.2.1p16).
-bool Type::isConstantSizeType(ASTContext &Ctx, SourceLocation *loc) const {
- if (isa<VariableArrayType>(CanonicalType))
+bool Type::isConstantSizeType(ASTContext &Ctx, SourceLocation *Loc) const {
+ assert(!isIncompleteType() && "This doesn't make sense for incomplete types");
+ if (const VariableArrayType *VAT =dyn_cast<VariableArrayType>(CanonicalType)){
+ // The VAT must have a size, as it is known to be complete.
+ if (Loc) *Loc = VAT->getSizeExpr()->getLocStart();
return false;
+ }
return true;
}
More information about the cfe-commits
mailing list