diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-01-10 04:58:17 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-01-10 04:58:17 +0000 |
commit | c4b251dc2bc66f753f279fa904da6861093ae1e6 (patch) | |
tree | 9f2c246ca837406d87743ff79548d746bc3c4342 /clang/lib/CodeGen | |
parent | 1bc5c2c7efe8652f5b0599d52ad5fa2b563dfc28 (diff) | |
download | bcm5719-llvm-c4b251dc2bc66f753f279fa904da6861093ae1e6.tar.gz bcm5719-llvm-c4b251dc2bc66f753f279fa904da6861093ae1e6.zip |
Implement the missing pieces of Evaluate for _Complex types. With that complete, remove some code from CGExprConstant which is no longer necessary. While I'm here, a couple minor tweaks to _Complex-in-C++. (Specifically, make _Complex types literal types, and don't warn for _Complex int.)
llvm-svn: 147840
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index 826a950148a..a8399d719f2 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -681,31 +681,6 @@ public: } llvm::Constant *VisitInitListExpr(InitListExpr *ILE) { - if (ILE->getType()->isAnyComplexType() && ILE->getNumInits() == 2) { - // Complex type with element initializers - Expr *Real = ILE->getInit(0); - Expr *Imag = ILE->getInit(1); - llvm::Constant *Complex[2]; - Complex[0] = CGM.EmitConstantExpr(Real, Real->getType(), CGF); - if (!Complex[0]) - return 0; - Complex[1] = CGM.EmitConstantExpr(Imag, Imag->getType(), CGF); - if (!Complex[1]) - return 0; - llvm::StructType *STy = - cast<llvm::StructType>(ConvertType(ILE->getType())); - return llvm::ConstantStruct::get(STy, Complex); - } - - if (ILE->getType()->isScalarType()) { - // We have a scalar in braces. Just use the first element. - if (ILE->getNumInits() > 0) { - Expr *Init = ILE->getInit(0); - return CGM.EmitConstantExpr(Init, Init->getType(), CGF); - } - return CGM.EmitNullConstant(ILE->getType()); - } - if (ILE->getType()->isArrayType()) return EmitArrayInitialization(ILE); @@ -715,11 +690,7 @@ public: if (ILE->getType()->isUnionType()) return EmitUnionInitialization(ILE); - // If ILE was a constant vector, we would have handled it already. - if (ILE->getType()->isVectorType()) - return 0; - - llvm_unreachable("Unable to handle InitListExpr"); + return 0; } llvm::Constant *VisitCXXConstructExpr(CXXConstructExpr *E) { |