return MLV_Valid;
}
+/// hasStaticStorage - Return true if this expression has static storage
+/// duration. This means that the address of this expression is a link-time
+/// constant.
bool Expr::hasStaticStorage() const {
switch (getStmtClass()) {
default:
return false;
+ case ParenExprClass:
+ return cast<ParenExpr>(this)->getSubExpr()->hasStaticStorage();
+ case ImplicitCastExprClass:
+ return cast<ImplicitCastExpr>(this)->getSubExpr()->hasStaticStorage();
case DeclRefExprClass: {
const Decl *D = cast<DeclRefExpr>(this)->getDecl();
if (const VarDecl *VD = dyn_cast<VarDecl>(D))
case MemberExprClass:
const MemberExpr *M = cast<MemberExpr>(this);
return !M->isArrow() && M->getBase()->hasStaticStorage();
+ case ArraySubscriptExprClass:
+ return cast<ArraySubscriptExpr>(this)->getBase()->hasStaticStorage();
}
}
bool isConstantExpr(ASTContext &Ctx, SourceLocation *Loc) const;
/// hasStaticStorage - Return true if this expression has static storage
- /// duration.
+ /// duration. This means that the address of this expression is a link-time
+ /// constant.
bool hasStaticStorage() const;
static bool classof(const Stmt *T) {
void foo(void);
fp a[1] = { foo };
+int myArray[5] = {1, 2, 3, 4, 5};
+int *myPointer2 = myArray;
+int *myPointer = &(myArray[2]);
+