diff options
author | Anders Carlsson <andersca@mac.com> | 2008-11-22 21:04:56 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2008-11-22 21:04:56 +0000 |
commit | 51fe996231b1d7199f76e4005ff4c943d5deeecd (patch) | |
tree | 1875a61857e1db12563ccffd71b5da30363adc4c /lib/CodeGen/CGStmt.cpp | |
parent | f3a05d93628242b787f9cc26b6ce5baf0acd00a1 (diff) |
Use Expr::Evaluate for case statements. Fixes PR2525
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59881 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 3f2cd803da..0a67e57e34 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -533,8 +533,8 @@ void CodeGenFunction::EmitContinueStmt(const ContinueStmt &S) { void CodeGenFunction::EmitCaseStmtRange(const CaseStmt &S) { assert(S.getRHS() && "Expected RHS value in CaseStmt"); - llvm::APSInt LHS = S.getLHS()->getIntegerConstantExprValue(getContext()); - llvm::APSInt RHS = S.getRHS()->getIntegerConstantExprValue(getContext()); + llvm::APSInt LHS = S.getLHS()->EvaluateAsInt(getContext()); + llvm::APSInt RHS = S.getRHS()->EvaluateAsInt(getContext()); // Emit the code for this case. We do this first to make sure it is // properly chained from our predecessor before generating the @@ -594,7 +594,7 @@ void CodeGenFunction::EmitCaseStmt(const CaseStmt &S) { EmitBlock(createBasicBlock("sw.bb")); llvm::BasicBlock *CaseDest = Builder.GetInsertBlock(); - llvm::APSInt CaseVal = S.getLHS()->getIntegerConstantExprValue(getContext()); + llvm::APSInt CaseVal = S.getLHS()->EvaluateAsInt(getContext()); SwitchInsn->addCase(llvm::ConstantInt::get(CaseVal), CaseDest); EmitStmt(S.getSubStmt()); } |