[cfe-commits] r64197 - in /cfe/trunk: lib/CodeGen/CGExprComplex.cpp test/Coverage/c-language-features.inc
Daniel Dunbar
daniel at zuster.org
Mon Feb 9 19:03:32 PST 2009
Author: ddunbar
Date: Mon Feb 9 21:03:30 2009
New Revision: 64197
URL: http://llvm.org/viewvc/llvm-project?rev=64197&view=rev
Log:
Support va_arg on _Complex.
gcc compat test suite results (Darwin x86-32 & -64):
--
# of expected passes 1110
# of unexpected failures 74
# of unresolved testcases 168
# of unsupported tests 2
Modified:
cfe/trunk/lib/CodeGen/CGExprComplex.cpp
cfe/trunk/test/Coverage/c-language-features.inc
Modified: cfe/trunk/lib/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=64197&r1=64196&r2=64197&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprComplex.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprComplex.cpp Mon Feb 9 21:03:30 2009
@@ -192,6 +192,8 @@
ComplexPairTy VisitChooseExpr(ChooseExpr *CE);
ComplexPairTy VisitInitListExpr(InitListExpr *E);
+
+ ComplexPairTy VisitVAArgExpr(VAArgExpr *E);
};
} // end anonymous namespace.
@@ -528,6 +530,22 @@
return ComplexPairTy(zeroConstant, zeroConstant);
}
+ComplexPairTy ComplexExprEmitter::VisitVAArgExpr(VAArgExpr *E) {
+ llvm::Value *ArgValue = CGF.EmitLValue(E->getSubExpr()).getAddress();
+ llvm::Value *ArgPtr = CGF.EmitVAArg(ArgValue, E->getType());
+
+ if (!ArgPtr) {
+ CGF.ErrorUnsupported(E, "complex va_arg expression");
+ const llvm::Type *EltTy =
+ CGF.ConvertType(E->getType()->getAsComplexType()->getElementType());
+ llvm::Value *U = llvm::UndefValue::get(EltTy);
+ return ComplexPairTy(U, U);
+ }
+
+ // FIXME Volatility.
+ return EmitLoadOfComplex(ArgPtr, false);
+}
+
//===----------------------------------------------------------------------===//
// Entry Point into this File
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/test/Coverage/c-language-features.inc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/c-language-features.inc?rev=64197&r1=64196&r2=64197&view=diff
==============================================================================
--- cfe/trunk/test/Coverage/c-language-features.inc (original)
+++ cfe/trunk/test/Coverage/c-language-features.inc Mon Feb 9 21:03:30 2009
@@ -103,6 +103,7 @@
int t12_0 = __builtin_classify_type(t0);
int t12_1 = __builtin_classify_type(t1);
int t12_2 = __builtin_classify_type(t2);
+ // FIXME: Add _Complex and aggregate cases.
int t13 = va_arg(ap, int);
va_list t13_0;
va_copy(t13_0, ap);
More information about the cfe-commits
mailing list