Support -Wshorten-64-to-32 for integer types only, which seems to satisfy the
core requirements. Fixes rdar://problem/6389954
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86364 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 951856d..38063ac 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -665,6 +665,10 @@
if (IsExprValueWithinWidth(S.Context, E, TargetWidth))
return;
+ // People want to build with -Wshorten-64-to-32 and not -Wconversion
+ // and by god we'll let them.
+ if (SourceWidth == 64 && TargetWidth == 32)
+ return DiagnoseImpCast(S, E, T, diag::warn_impcast_integer_64_32);
return DiagnoseImpCast(S, E, T, diag::warn_impcast_integer_precision);
}