r201000 - Fold together two repeated identical 'if's.

Richard Smith richard-llvm at metafoo.co.uk
Fri Feb 7 14:39:54 PST 2014


Author: rsmith
Date: Fri Feb  7 16:39:53 2014
New Revision: 201000

URL: http://llvm.org/viewvc/llvm-project?rev=201000&view=rev
Log:
Fold together two repeated identical 'if's.

Modified:
    cfe/trunk/lib/Sema/SemaExprCXX.cpp

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=201000&r1=200999&r2=201000&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Feb  7 16:39:53 2014
@@ -2076,18 +2076,16 @@ void Sema::DeclareGlobalAllocationFuncti
     }
   }
 
-  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;





More information about the cfe-commits mailing list