| OLD | NEW |
| 1 //===--- CodeGenFunction.cpp - Emit LLVM Code from ASTs for a Function ----===// | 1 //===--- CodeGenFunction.cpp - Emit LLVM Code from ASTs for a Function ----===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This coordinates the per-function state used while generating code. | 10 // This coordinates the per-function state used while generating code. |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 cond.end(*this); | 921 cond.end(*this); |
| 922 | 922 |
| 923 cond.begin(*this); | 923 cond.begin(*this); |
| 924 EmitBlock(RHSBlock); | 924 EmitBlock(RHSBlock); |
| 925 EmitBranchOnBoolExpr(CondOp->getRHS(), TrueBlock, FalseBlock); | 925 EmitBranchOnBoolExpr(CondOp->getRHS(), TrueBlock, FalseBlock); |
| 926 cond.end(*this); | 926 cond.end(*this); |
| 927 | 927 |
| 928 return; | 928 return; |
| 929 } | 929 } |
| 930 | 930 |
| 931 if (const CXXThrowExpr *Throw = dyn_cast<CXXThrowExpr>(Cond)) { | |
| 932 // Conditional operator handling can give us a throw expression as a | |
| 933 // condition for a case like: | |
| 934 // br(c ? throw x : y, t, f) -> br(c, br(throw x, t, f), br(y, t, f) | |
| 935 // Fold this to: | |
| 936 // br(c, throw x, br(y, t, f)) | |
| 937 EmitCXXThrowExpr(Throw, /*KeepInsertionPoint*/false); | |
| 938 return; | |
| 939 } | |
| 940 | |
| 941 // Emit the code with the fully general case. | 931 // Emit the code with the fully general case. |
| 942 llvm::Value *CondV = EvaluateExprAsBool(Cond); | 932 llvm::Value *CondV = EvaluateExprAsBool(Cond); |
| 943 Builder.CreateCondBr(CondV, TrueBlock, FalseBlock); | 933 Builder.CreateCondBr(CondV, TrueBlock, FalseBlock); |
| 944 } | 934 } |
| 945 | 935 |
| 946 /// ErrorUnsupported - Print out an error that codegen doesn't support the | 936 /// ErrorUnsupported - Print out an error that codegen doesn't support the |
| 947 /// specified stmt yet. | 937 /// specified stmt yet. |
| 948 void CodeGenFunction::ErrorUnsupported(const Stmt *S, const char *Type, | 938 void CodeGenFunction::ErrorUnsupported(const Stmt *S, const char *Type, |
| 949 bool OmitOnError) { | 939 bool OmitOnError) { |
| 950 CGM.ErrorUnsupported(S, Type, OmitOnError); | 940 CGM.ErrorUnsupported(S, Type, OmitOnError); |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 // annotation on the first field of a struct and annotation on the struct | 1430 // annotation on the first field of a struct and annotation on the struct |
| 1441 // itself. | 1431 // itself. |
| 1442 if (VTy != CGM.Int8PtrTy) | 1432 if (VTy != CGM.Int8PtrTy) |
| 1443 V = Builder.Insert(new llvm::BitCastInst(V, CGM.Int8PtrTy)); | 1433 V = Builder.Insert(new llvm::BitCastInst(V, CGM.Int8PtrTy)); |
| 1444 V = EmitAnnotationCall(F, V, (*ai)->getAnnotation(), D->getLocation()); | 1434 V = EmitAnnotationCall(F, V, (*ai)->getAnnotation(), D->getLocation()); |
| 1445 V = Builder.CreateBitCast(V, VTy); | 1435 V = Builder.CreateBitCast(V, VTy); |
| 1446 } | 1436 } |
| 1447 | 1437 |
| 1448 return V; | 1438 return V; |
| 1449 } | 1439 } |
| OLD | NEW |