aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-09-15 05:28:24 +0000
committerAnders Carlsson <andersca@mac.com>2009-09-15 05:28:24 +0000
commit4c5fad3f73957420b0410f7370cbd63b09f32a1c (patch)
tree0aaf05f4f38f9ca7c0af9da85cd43749d2e7ae57 /lib/Sema/Sema.cpp
parentc0a2fd8f092722c8f78b566ac4506a21437040e9 (diff)
Only reuse an already existing ImplicitCastExpr if the cast kinds are the same.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81841 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r--lib/Sema/Sema.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 474ea16e57..5a31296781 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -230,10 +230,14 @@ void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
}
if (ImplicitCastExpr *ImpCast = dyn_cast<ImplicitCastExpr>(Expr)) {
- ImpCast->setType(Ty);
- ImpCast->setLvalueCast(isLvalue);
- } else
- Expr = new (Context) ImplicitCastExpr(Ty, Kind, Expr, isLvalue);
+ if (ImpCast->getCastKind() == Kind) {
+ ImpCast->setType(Ty);
+ ImpCast->setLvalueCast(isLvalue);
+ return;
+ }
+ }
+
+ Expr = new (Context) ImplicitCastExpr(Ty, Kind, Expr, isLvalue);
}
void Sema::DeleteExpr(ExprTy *E) {