summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-11-22 21:04:56 +0000
committerAnders Carlsson <andersca@mac.com>2008-11-22 21:04:56 +0000
commit59689ed7644e816eee05330426ee041183501935 (patch)
treeba4072257fdc4c0b38c0f87af378bea04c122b24 /clang/lib/CodeGen/CGStmt.cpp
parent2fedf0e8f722e64cf8b0c878c9346dc5a998919b (diff)
downloadbcm5719-llvm-59689ed7644e816eee05330426ee041183501935.tar.gz
bcm5719-llvm-59689ed7644e816eee05330426ee041183501935.zip
Use Expr::Evaluate for case statements. Fixes PR2525
llvm-svn: 59881
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 3f2cd803dab..0a67e57e343 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/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());
}
OpenPOWER on IntegriCloud