From c015bc25955227dbd47e0ae6b283a60d104e0e68 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Fri, 7 Feb 2014 22:39:53 +0000 Subject: [PATCH] Fold together two repeated identical 'if's. llvm-svn: 201000 --- clang/lib/Sema/SemaExprCXX.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index d43f17017ae5..08fd14cef400 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -2076,18 +2076,16 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, } } - QualType BadAllocType; + FunctionProtoType::ExtProtoInfo EPI; + bool HasBadAllocExceptionSpec = (Name.getCXXOverloadedOperator() == OO_New || Name.getCXXOverloadedOperator() == OO_Array_New); - if (HasBadAllocExceptionSpec && !getLangOpts().CPlusPlus11) { - assert(StdBadAlloc && "Must have std::bad_alloc declared"); - BadAllocType = Context.getTypeDeclType(getStdBadAlloc()); - } - - FunctionProtoType::ExtProtoInfo EPI; if (HasBadAllocExceptionSpec) { if (!getLangOpts().CPlusPlus11) { + assert(StdBadAlloc && "Must have std::bad_alloc declared"); + QualType BadAllocType = Context.getTypeDeclType(getStdBadAlloc()); + EPI.ExceptionSpecType = EST_Dynamic; EPI.NumExceptions = 1; EPI.Exceptions = &BadAllocType; -- GitLab