summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-10-13 22:12:09 +0000
committerChris Lattner <sabre@nondot.org>2009-10-13 22:12:09 +0000
commita2f9bd53398f38f2dd00828be139cc7bae552749 (patch)
tree5bdb9bea37e81b0819273070a708d092c2794891 /clang/lib/AST/Expr.cpp
parentc10e88db2215386ec221b41403b168885916b52a (diff)
downloadbcm5719-llvm-a2f9bd53398f38f2dd00828be139cc7bae552749.tar.gz
bcm5719-llvm-a2f9bd53398f38f2dd00828be139cc7bae552749.zip
fix test/CodeGen/statements.c on 32-bit hosts.
llvm-svn: 84039
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 8516d41df6c..0e4a29f916f 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -1281,6 +1281,13 @@ bool Expr::isConstantInitializer(ASTContext &Ctx) const {
// cast-to-union extension.
if (getType()->isRecordType())
return cast<CastExpr>(this)->getSubExpr()->isConstantInitializer(Ctx);
+
+ // Integer->integer casts can be handled here, which is important for
+ // things like (int)(&&x-&&y). Scary but true.
+ if (getType()->isIntegerType() &&
+ cast<CastExpr>(this)->getSubExpr()->getType()->isIntegerType())
+ return cast<CastExpr>(this)->getSubExpr()->isConstantInitializer(Ctx);
+
break;
}
return isEvaluatable(Ctx);
OpenPOWER on IntegriCloud