diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-01-24 19:49:13 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-01-24 19:49:13 +0000 |
| commit | 619393762b88650d6df0ffa833e12d50b2f81cd0 (patch) | |
| tree | 5faf094f6e1456f34bac92eeba960379f371f52a | |
| parent | b1355b1545e7d32d504e8aa06cdc09bac13c549b (diff) | |
| download | bcm5719-llvm-619393762b88650d6df0ffa833e12d50b2f81cd0.tar.gz bcm5719-llvm-619393762b88650d6df0ffa833e12d50b2f81cd0.zip | |
fix a fixme, don't leak the expr on error.
llvm-svn: 62927
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 9a4977d09b9..fa4c9d620af 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1049,18 +1049,23 @@ Sema::ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType, if (isType) { ArgTy = QualType::getFromOpaquePtr(TyOrEx); Range = ArgRange; + + // Verify that the operand is valid. + if (CheckSizeOfAlignOfOperand(ArgTy, OpLoc, Range, isSizeof)) + return ExprError(); } else { // Get the end location. Expr *ArgEx = (Expr *)TyOrEx; Range = ArgEx->getSourceRange(); ArgTy = ArgEx->getType(); + + // Verify that the operand is valid. + if (CheckSizeOfAlignOfOperand(ArgTy, OpLoc, Range, isSizeof)) { + DeleteExpr(ArgEx); + return ExprError(); + } } - // Verify that the operand is valid. - // FIXME: This might leak the expression. - if (CheckSizeOfAlignOfOperand(ArgTy, OpLoc, Range, isSizeof)) - return ExprError(); - // C99 6.5.3.4p4: the type (an unsigned integer type) is size_t. return Owned(new (Context) SizeOfAlignOfExpr(isSizeof, isType, TyOrEx, Context.getSizeType(), OpLoc, |

