diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-04-12 22:40:54 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-04-12 22:40:54 +0000 |
commit | 37050841d7b852497b85d5275d9ea92c07ddf059 (patch) | |
tree | e1bc33516c1924d2b3ef4567571958257855eaa1 /lib/Sema/SemaChecking.cpp | |
parent | 6a86082f3a06a2dcceaaf63f78a0e52d64bcbaa3 (diff) |
Warn on 64-to-32 for source value of x bits where 64 >= x > 32.
The codepath already only works for source bits > target bits, it's just that
it was testing for the source expr bits to be exactly 64. This meant simple
cases (int i = x_long / 2) were missed & ended up under the general
-Wconversion warning, which a user might not have enabled.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154626 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 1606e336ee..7fabfaf565 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -4233,7 +4233,7 @@ void CheckImplicitConversion(Sema &S, Expr *E, QualType T, if (S.SourceMgr.isInSystemMacro(CC)) return; - if (SourceRange.Width == 64 && TargetRange.Width == 32) + if (TargetRange.Width == 32 && S.Context.getIntWidth(E->getType()) == 64) return DiagnoseImpCast(S, E, T, CC, diag::warn_impcast_integer_64_32, /* pruneControlFlow */ true); return DiagnoseImpCast(S, E, T, CC, diag::warn_impcast_integer_precision); |