]> granicus.if.org Git - clang/commitdiff
Remove late nullptr pointer test (PR32447)
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 1 Jun 2017 18:13:02 +0000 (18:13 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 1 Jun 2017 18:13:02 +0000 (18:13 +0000)
IgnoreNarrowingConversion should never return nullptr, but I've added an assert just in case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304444 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp

index 1ba84034fa4739929f9103b27950d1bf9a0fd590..e0583d7164026e83ab9be026ea49a3f1496be88a 100644 (file)
@@ -330,13 +330,13 @@ StandardConversionSequence::getNarrowingKind(ASTContext &Ctx,
     } else if (FromType->isIntegralType(Ctx) && ToType->isRealFloatingType()) {
       llvm::APSInt IntConstantValue;
       const Expr *Initializer = IgnoreNarrowingConversion(Converted);
+      assert(Initializer && "Unknown conversion expression");
 
       // If it's value-dependent, we can't tell whether it's narrowing.
       if (Initializer->isValueDependent())
         return NK_Dependent_Narrowing;
 
-      if (Initializer &&
-          Initializer->isIntegerConstantExpr(IntConstantValue, Ctx)) {
+      if (Initializer->isIntegerConstantExpr(IntConstantValue, Ctx)) {
         // Convert the integer to the floating type.
         llvm::APFloat Result(Ctx.getFloatTypeSemantics(ToType));
         Result.convertFromAPInt(IntConstantValue, IntConstantValue.isSigned(),