if (const Expr *LVBase = Base.Val.getLValueBase())
if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(LVBase)) {
if (const VarDecl *VD = dyn_cast<VarDecl>(DRE->getDecl())) {
- uint64_t Size = Info.Ctx.getTypeSize(VD->getType()) / 8;
- uint64_t Offset = Base.Val.getLValueOffset();
- if (Offset <= Size)
- Size -= Base.Val.getLValueOffset();
- else
- Size = 0;
- return Success(Size, E);
+ if (!VD->getType()->isIncompleteType()
+ && VD->getType()->isObjectType()
+ && !VD->getType()->isVariablyModifiedType()
+ && !VD->getType()->isDependentType()) {
+ uint64_t Size = Info.Ctx.getTypeSize(VD->getType()) / 8;
+ uint64_t Offset = Base.Val.getLValueOffset();
+ if (Offset <= Size)
+ Size -= Base.Val.getLValueOffset();
+ else
+ Size = 0;
+ return Success(Size, E);
+ }
}
}