diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-12-18 07:03:30 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-12-18 07:03:30 +0000 |
| commit | 6d2d1b67ca90486c546e896d7fd1642ce86b09ce (patch) | |
| tree | 57273fca429f8d3b500be89fcba9430ff833b849 | |
| parent | 78e34a00f49d512f3350a7c1687d0f0cfd520d03 (diff) | |
| download | bcm5719-llvm-6d2d1b67ca90486c546e896d7fd1642ce86b09ce.tar.gz bcm5719-llvm-6d2d1b67ca90486c546e896d7fd1642ce86b09ce.zip | |
Fix PR1863: an assertion due to not setting a location on return from
this method.
llvm-svn: 45153
| -rw-r--r-- | clang/AST/Type.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/AST/Type.cpp b/clang/AST/Type.cpp index 63f35897695..ccd4630843d 100644 --- a/clang/AST/Type.cpp +++ b/clang/AST/Type.cpp @@ -449,9 +449,13 @@ bool Type::isAggregateType() const { // 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; } |

