aboutsummaryrefslogtreecommitdiff
path: root/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
commita6afa768aa7bd3102a2807aa720917e4a1771e4e (patch)
tree3876977b5d606d1263ee05b1e880c2a71c2a2ed4 /lib/AST/Expr.cpp
parentb087ae912bc24e84bf2a7f96f08daeec397fb9bd (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59224 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r--lib/AST/Expr.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index c54fc40ecb..c320cfc670 100644
--- a/lib/AST/Expr.cpp
+++ b/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();