Replaced ASTContext::maxFloatingType() with ASTContext::compareFloatingType().

Changed Sema::UsualArithmeticConversions to use the new API.

This fixes the following case...

_Complex double X;
double y;

void foo() {
  X = X + y;
}

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang complex.c -parse-ast-dump
Read top-level variable decl: 'X'
Read top-level variable decl: 'y'

void foo()
(CompoundStmt 0x2605cc0
  (BinaryOperator 0x2605ca0 '_Complex double' '='
    (DeclRefExpr 0x2605c10 '_Complex double' Decl='X' 0x2605ab0)
    (BinaryOperator 0x2605c80 '_Complex double' '+'
      (DeclRefExpr 0x2605c30 '_Complex double' Decl='X' 0x2605ab0)
      (ImplicitCastExpr 0x2605c70 '_Complex double'
        (DeclRefExpr 0x2605c50 'double' Decl='y' 0x2605ae0)))))



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41483 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp
index b0b963c..4b79582 100644
--- a/AST/ASTContext.cpp
+++ b/AST/ASTContext.cpp
@@ -710,9 +710,15 @@
   assert(0 && "getFloatingTypeOfSizeWithinDomain(): illegal domain");
 }
 
-// maxFloatingType - handles the simple case, both operands are floats.
-QualType ASTContext::maxFloatingType(QualType lt, QualType rt) {
-  return getFloatingRank(lt) > getFloatingRank(rt) ? lt : rt;
+/// compareFloatingType - Handles 3 different combos: 
+/// float/float, float/complex, complex/complex. 
+/// If lt > rt, return 1. If lt == rt, return 0. If lt < rt, return -1. 
+int ASTContext::compareFloatingType(QualType lt, QualType rt) {
+  if (getFloatingRank(lt) == getFloatingRank(rt))
+    return 0;
+  if (getFloatingRank(lt) > getFloatingRank(rt))
+    return 1;
+  return -1;
 }
 
 // maxIntegerType - Returns the highest ranked integer type. Handles 3 case: