Fix for PR4502: add calculation of the integer conversion rank for 
wchar_t.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74808 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 2877cc3..0075815 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -2245,6 +2245,9 @@
   if (EnumType* ET = dyn_cast<EnumType>(T))
     T = ET->getDecl()->getIntegerType().getTypePtr();
 
+  if (T->isSpecificBuiltinType(BuiltinType::WChar))
+    T = getFromTargetType(Target.getWCharType()).getTypePtr();
+
   // There are two things which impact the integer rank: the width, and
   // the ordering of builtins.  The builtin ordering is encoded in the
   // bottom three bits; the width is encoded in the bits above that.