aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-11-11 22:52:37 +0000
committerJohn McCall <rjmccall@apple.com>2009-11-11 22:52:37 +0000
commit8406aedf4782771e520614ee379594dc0a4f7d5f (patch)
tree7fff4c7ebf52dbfaf5d57cc691abec45f98840c8 /lib/Sema/Sema.cpp
parentf42d74f41076542fc9b4f4d5fa034dfa93b3c916 (diff)
Fix PR 5422: handle lvalue results when evaluating 'based' ptrtoints as part of
the -Wconversion check. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86891 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r--lib/Sema/Sema.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 5c92b65f82..f6f572feec 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -424,9 +424,15 @@ static bool IsSameIntAfterCast(const APValue &value, unsigned TargetWidth) {
return true;
}
- assert(value.isComplexInt());
- return IsSameIntAfterCast(value.getComplexIntReal(), TargetWidth) &&
- IsSameIntAfterCast(value.getComplexIntImag(), TargetWidth);
+ if (value.isComplexInt()) {
+ return IsSameIntAfterCast(value.getComplexIntReal(), TargetWidth) &&
+ IsSameIntAfterCast(value.getComplexIntImag(), TargetWidth);
+ }
+
+ // This can happen with lossless casts to intptr_t of "based" lvalues.
+ // Assume it might use arbitrary bits.
+ assert(value.isLValue());
+ return false;
}