Add support for vectors to APValue. Vector constant evaluator and tests coming.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62438 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/APValue.cpp b/lib/AST/APValue.cpp
index 38a89aa..87d9fc3 100644
--- a/lib/AST/APValue.cpp
+++ b/lib/AST/APValue.cpp
@@ -23,6 +23,8 @@
MakeInt();
else if (RHS.isFloat())
MakeFloat();
+ else if (RHS.isVector())
+ MakeVector();
else if (RHS.isComplexInt())
MakeComplexInt();
else if (RHS.isComplexFloat())
@@ -34,6 +36,8 @@
setInt(RHS.getInt());
else if (isFloat())
setFloat(RHS.getFloat());
+ else if (isVector())
+ setVector(((Vec*)(void*)RHS.Data)->Elts, RHS.getVectorLength());
else if (isComplexInt())
setComplexInt(RHS.getComplexIntReal(), RHS.getComplexIntImag());
else if (isComplexFloat())
@@ -48,6 +52,8 @@
((APSInt*)(void*)Data)->~APSInt();
else if (Kind == Float)
((APFloat*)(void*)Data)->~APFloat();
+ else if (Kind == Vector)
+ ((Vec*)(void*)Data)->~Vec();
else if (Kind == ComplexInt)
((ComplexAPSInt*)(void*)Data)->~ComplexAPSInt();
else if (Kind == ComplexFloat)
@@ -55,6 +61,7 @@
else if (Kind == LValue) {
((LV*)(void*)Data)->~LV();
}
+ Kind = Uninitialized;
}
void APValue::dump() const {
@@ -83,6 +90,9 @@
case Float:
OS << "Float: " << GetApproxValue(getFloat());
return;
+ case Vector:
+ OS << "Vector: <todo>";
+ return;
case ComplexInt:
OS << "ComplexInt: " << getComplexIntReal() << ", " << getComplexIntImag();
return;