aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/APValue.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-09-08 19:57:33 +0000
committerDouglas Gregor <dgregor@apple.com>2009-09-08 19:57:33 +0000
commit983004686a1bfc816f7aeb47bac7e16049550278 (patch)
tree1d78a02ab720b208d737f1b09e98999a70b205aa /lib/AST/APValue.cpp
parentac423ba85bb59cc7cc1d43081b20d7e8d40355ff (diff)
Make sure to access APValue's data via a char array (rather than
through an array of void*), so that we don't run afoul of the strict-aliasing rules in C++ 3.10p15. Unfortunately, GCC 4.4 still complains about this code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81251 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/APValue.cpp')
-rw-r--r--lib/AST/APValue.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/AST/APValue.cpp b/lib/AST/APValue.cpp
index 4df7671c5a..489dac7970 100644
--- a/lib/AST/APValue.cpp
+++ b/lib/AST/APValue.cpp
@@ -37,7 +37,7 @@ const APValue &APValue::operator=(const APValue &RHS) {
else if (isFloat())
setFloat(RHS.getFloat());
else if (isVector())
- setVector(((Vec*)(void*)RHS.Data)->Elts, RHS.getVectorLength());
+ setVector(((Vec*)(char*)RHS.Data)->Elts, RHS.getVectorLength());
else if (isComplexInt())
setComplexInt(RHS.getComplexIntReal(), RHS.getComplexIntImag());
else if (isComplexFloat())
@@ -49,17 +49,17 @@ const APValue &APValue::operator=(const APValue &RHS) {
void APValue::MakeUninit() {
if (Kind == Int)
- ((APSInt*)(void*)Data)->~APSInt();
+ ((APSInt*)(char*)Data)->~APSInt();
else if (Kind == Float)
- ((APFloat*)(void*)Data)->~APFloat();
+ ((APFloat*)(char*)Data)->~APFloat();
else if (Kind == Vector)
- ((Vec*)(void*)Data)->~Vec();
+ ((Vec*)(char*)Data)->~Vec();
else if (Kind == ComplexInt)
- ((ComplexAPSInt*)(void*)Data)->~ComplexAPSInt();
+ ((ComplexAPSInt*)(char*)Data)->~ComplexAPSInt();
else if (Kind == ComplexFloat)
- ((ComplexAPFloat*)(void*)Data)->~ComplexAPFloat();
+ ((ComplexAPFloat*)(char*)Data)->~ComplexAPFloat();
else if (Kind == LValue) {
- ((LV*)(void*)Data)->~LV();
+ ((LV*)(char*)Data)->~LV();
}
Kind = Uninitialized;
}