From: Richard Smith Date: Fri, 7 Feb 2014 22:39:53 +0000 (+0000) Subject: Fold together two repeated identical 'if's. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=17ef7ef24312fca79980f0db621886ebd9e77dfa;p=clang Fold together two repeated identical 'if's. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201000 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index d43f17017a..08fd14cef4 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/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;