summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-11-13 06:09:17 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-11-13 06:09:17 +0000
commit5a332ea01f2d00a0d960aecdcb6191efcf42b5ae (patch)
tree99482c24d7cc26fac2f01faeb748390b9a834af9 /clang/lib/AST/Expr.cpp
parent4b27eb4d26b50b03a10b50132a0b84175a9c1134 (diff)
downloadbcm5719-llvm-5a332ea01f2d00a0d960aecdcb6191efcf42b5ae.tar.gz
bcm5719-llvm-5a332ea01f2d00a0d960aecdcb6191efcf42b5ae.zip
Fix for crash issues with comma operators with a void first operand, and
some more bullet-proofing/enhancements for tryEvaluate. This shouldn't cause any behavior changes except for handling cases where we were crashing before and being able to evaluate a few more cases in tryEvaluate. This should settle the minor mess surrounding r59196. llvm-svn: 59224
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index c54fc40ecb2..c320cfc6701 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -733,6 +733,12 @@ bool Expr::isConstantExpr(ASTContext &Ctx, SourceLocation *Loc) const {
/// cast+dereference.
bool Expr::isIntegerConstantExpr(llvm::APSInt &Result, ASTContext &Ctx,
SourceLocation *Loc, bool isEvaluated) const {
+ // Pretest for integral type; some parts of the code crash for types that
+ // can't be sized.
+ if (!getType()->isIntegralType()) {
+ if (Loc) *Loc = getLocStart();
+ return false;
+ }
switch (getStmtClass()) {
default:
if (Loc) *Loc = getLocStart();
OpenPOWER on IntegriCloud