diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2009-02-10 03:03:30 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2009-02-10 03:03:30 +0000 |
| commit | 0007961241d8db04fd04c4db3ff78ddd9f202cea (patch) | |
| tree | bb7f3a47dcaa83b0a00d384b9759fee7328fb3f9 /clang/lib/CodeGen/CGExprComplex.cpp | |
| parent | 2ca8d5dfdf67766ca1226966e552edf9100f89e4 (diff) | |
| download | llvm-0007961241d8db04fd04c4db3ff78ddd9f202cea.zip llvm-0007961241d8db04fd04c4db3ff78ddd9f202cea.tar.gz llvm-0007961241d8db04fd04c4db3ff78ddd9f202cea.tar.bz2 | |
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
llvm-svn: 64197
Diffstat (limited to 'clang/lib/CodeGen/CGExprComplex.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExprComplex.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp index 387635c..89a206d 100644 --- a/clang/lib/CodeGen/CGExprComplex.cpp +++ b/clang/lib/CodeGen/CGExprComplex.cpp @@ -192,6 +192,8 @@ public: ComplexPairTy VisitChooseExpr(ChooseExpr *CE); ComplexPairTy VisitInitListExpr(InitListExpr *E); + + ComplexPairTy VisitVAArgExpr(VAArgExpr *E); }; } // end anonymous namespace. @@ -528,6 +530,22 @@ ComplexPairTy ComplexExprEmitter::VisitInitListExpr(InitListExpr *E) { 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 //===----------------------------------------------------------------------===// |
