summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCast.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2012-02-15 01:22:51 +0000
committerJohn McCall <rjmccall@apple.com>2012-02-15 01:22:51 +0000
commitc62bb3914260c9b864dcf88e8a12ee645f5368da (patch)
tree7128c79cc1a2fea3a832f3b1505b2bcadf6e48b6 /clang/lib/Sema/SemaCast.cpp
parent4dd0963d56096eb3de1b6beaa5deee57be384e95 (diff)
downloadbcm5719-llvm-c62bb3914260c9b864dcf88e8a12ee645f5368da.tar.gz
bcm5719-llvm-c62bb3914260c9b864dcf88e8a12ee645f5368da.zip
Split reinterpret_casts of member pointers out from CK_BitCast; this
is general goodness because representations of member pointers are not always equivalent across member pointer types on all ABIs (even though this isn't really standard-endorsed). Take advantage of the new information to teach IR-generation how to do these reinterprets in constant initializers. Make sure this works when intermingled with hierarchy conversions (although this is not part of our motivating use case). Doing this in the constant-evaluator would probably have been better, but that would require a *lot* of extra structure in the representation of constant member pointers: you'd really have to track an arbitrary chain of hierarchy conversions and reinterpretations in order to get this right. Ultimately, this seems less complex. I also wasn't quite sure how to extend the constant evaluator to handle foldings that we don't actually want to treat as extended constant expressions. llvm-svn: 150551
Diffstat (limited to 'clang/lib/Sema/SemaCast.cpp')
-rw-r--r--clang/lib/Sema/SemaCast.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp
index c89582ff007..a36f6cbb009 100644
--- a/clang/lib/Sema/SemaCast.cpp
+++ b/clang/lib/Sema/SemaCast.cpp
@@ -1576,7 +1576,8 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr,
}
// A valid member pointer cast.
- Kind = IsLValueCast? CK_LValueBitCast : CK_BitCast;
+ assert(!IsLValueCast);
+ Kind = CK_ReinterpretMemberPointer;
return TC_Success;
}
OpenPOWER on IntegriCloud