summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2012-04-12 22:40:54 +0000
committerDavid Blaikie <dblaikie@gmail.com>2012-04-12 22:40:54 +0000
commit9455da0ea912b8b05879a2e25894c120923d54b9 (patch)
tree0875b389d36a51b5a0e13cbe8b96b6eeb808ce00 /clang/lib
parent8e0785286a8175cfb5315e29ca72a882e86e7d37 (diff)
downloadbcm5719-llvm-9455da0ea912b8b05879a2e25894c120923d54b9.tar.gz
bcm5719-llvm-9455da0ea912b8b05879a2e25894c120923d54b9.zip
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. llvm-svn: 154626
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 1606e336ee7..7fabfaf565c 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud