diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-06-22 23:21:00 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-06-22 23:21:00 +0000 |
commit | 4f0845ec62d5fb8be5d07adc09c54944ab952e5c (patch) | |
tree | cc35825694c0050cd905af70ac881dcdd36916e0 /lib/Sema/SemaExpr.cpp | |
parent | ab183dff7ed681f7140a8e32510c4f619b791d2e (diff) |
Check for placeholders early on in
Sema::CreateUnaryExprOrTypeTraitExpr() rather than recursing in some
cases. Fixes <rdar://problem/9659191>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133663 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index e4eb95379d..8914bf3835 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -3301,6 +3301,12 @@ Sema::CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, ExprResult Sema::CreateUnaryExprOrTypeTraitExpr(Expr *E, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind) { + ExprResult PE = CheckPlaceholderExpr(E); + if (PE.isInvalid()) + return ExprError(); + + E = PE.get(); + // Verify that the operand is valid. bool isInvalid = false; if (E->isTypeDependent()) { @@ -3312,10 +3318,6 @@ Sema::CreateUnaryExprOrTypeTraitExpr(Expr *E, SourceLocation OpLoc, } else if (E->getBitField()) { // C99 6.5.3.4p1. Diag(E->getExprLoc(), diag::err_sizeof_alignof_bitfield) << 0; isInvalid = true; - } else if (E->getType()->isPlaceholderType()) { - ExprResult PE = CheckPlaceholderExpr(E); - if (PE.isInvalid()) return ExprError(); - return CreateUnaryExprOrTypeTraitExpr(PE.take(), OpLoc, ExprKind); } else { isInvalid = CheckUnaryExprOrTypeTraitOperand(E, UETT_SizeOf); } |