diff options
| author | Steve Naroff <snaroff@apple.com> | 2007-10-18 18:55:53 +0000 |
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2007-10-18 18:55:53 +0000 |
| commit | 1bb21df47fbce4cf6fbe5a1ce19a576c0faf9593 (patch) | |
| tree | 87034c0bb7e88ed46cdcd7e1e1b0ba2cd007ff3f | |
| parent | 9715d9fb59e579ed3087e39ea9d99b7c126774e7 (diff) | |
| download | bcm5719-llvm-1bb21df47fbce4cf6fbe5a1ce19a576c0faf9593.tar.gz bcm5719-llvm-1bb21df47fbce4cf6fbe5a1ce19a576c0faf9593.zip | |
Tweak a recent fix to UsualArithmeticConversions (made by Chris - r43113). The benefit of this tweak is it guarantees the entire routine operates on unqualified types (which I believe is a bit clearer).
llvm-svn: 43142
| -rw-r--r-- | clang/Sema/SemaExpr.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/Sema/SemaExpr.cpp b/clang/Sema/SemaExpr.cpp index 12897ea291c..28c68568622 100644 --- a/clang/Sema/SemaExpr.cpp +++ b/clang/Sema/SemaExpr.cpp @@ -867,12 +867,14 @@ QualType Sema::UsualArithmeticConversions(Expr *&lhsExpr, Expr *&rhsExpr, UsualUnaryConversions(lhsExpr); UsualUnaryConversions(rhsExpr); } - QualType lhs = lhsExpr->getType(); - QualType rhs = rhsExpr->getType(); + // For conversion purposes, we ignore any qualifiers. + // For example, "const float" and "float" are equivalent. + QualType lhs = lhsExpr->getType().getUnqualifiedType(); + QualType rhs = rhsExpr->getType().getUnqualifiedType(); // If both types are identical, no conversion is needed. - if (lhs.getTypePtr() == rhs.getTypePtr()) - return lhs.getQualifiedType(0); + if (lhs == rhs) + return lhs; // If either side is a non-arithmetic type (e.g. a pointer), we are done. // The caller can deal with this (e.g. pointer + int). |

