Track the location of the context requiring an implicit conversion and use it
to white-list conversions required by system headers.  rdar://problem/8232669

llvm-svn: 116029
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 1e7912c..fd196af 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -446,6 +446,7 @@
   Cond = CondResult.take();
   
   if (!CondVar) {
+    CheckImplicitConversions(Cond, SwitchLoc);
     CondResult = MaybeCreateCXXExprWithTemporaries(Cond);
     if (CondResult.isInvalid())
       return StmtError();
@@ -889,6 +890,7 @@
   if (CheckBooleanCondition(Cond, DoLoc))
     return StmtError();
 
+  CheckImplicitConversions(Cond, DoLoc);
   ExprResult CondResult = MaybeCreateCXXExprWithTemporaries(Cond);
   if (CondResult.isInvalid())
     return StmtError();
@@ -1173,8 +1175,10 @@
         return StmtError();
       }
       
-      if (RetValExp)
+      if (RetValExp) {
+        CheckImplicitConversions(RetValExp, ReturnLoc);
         RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp);
+      }
 
       RetValExp = Res.takeAs<Expr>();
       if (RetValExp) 
@@ -1227,6 +1231,7 @@
           << RetValExp->getSourceRange();
       }
 
+      CheckImplicitConversions(RetValExp, ReturnLoc);
       RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp);
     }
     
@@ -1269,8 +1274,10 @@
         CheckReturnStackAddr(RetValExp, FnRetType, ReturnLoc);
     }
     
-    if (RetValExp)
+    if (RetValExp) {
+      CheckImplicitConversions(RetValExp, ReturnLoc);
       RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp);
+    }
     Result = new (Context) ReturnStmt(ReturnLoc, RetValExp, NRVOCandidate);
   }