aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-09-27 21:58:52 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-09-27 21:58:52 +0000
commitc1c0dfb376b829b94d4c61e9f358ce23e6aa3169 (patch)
tree4c41ddf548926469fbe8b8de22022f06fe7c030b
parent1456fec8420de3dfce396de844a9e37d13417423 (diff)
Get rid of useless helper Sema::CastCategory.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140642 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Sema/Sema.h4
-rw-r--r--lib/Sema/Sema.cpp6
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--lib/Sema/SemaExprCXX.cpp11
-rw-r--r--lib/Sema/SemaInit.cpp2
-rw-r--r--lib/Sema/SemaTemplate.cpp6
6 files changed, 11 insertions, 20 deletions
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 92a6962a8d..f4ef5910dc 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -5406,10 +5406,6 @@ public:
void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E);
void AddAlignedAttr(SourceRange AttrRange, Decl *D, TypeSourceInfo *T);
- /// CastCategory - Get the correct forwarded implicit cast result category
- /// from the inner expression.
- ExprValueKind CastCategory(Expr *E);
-
/// \brief The kind of conversion being performed.
enum CheckedConversionKind {
/// \brief An implicit conversion.
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index d0c122a51c..54c4c98d4b 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -274,12 +274,6 @@ CastKind Sema::ScalarTypeToBooleanCastKind(QualType ScalarTy) {
return CK_Invalid;
}
-ExprValueKind Sema::CastCategory(Expr *E) {
- Expr::Classification Classification = E->Classify(Context);
- return Classification.isRValue() ? VK_RValue :
- (Classification.isLValue() ? VK_LValue : VK_XValue);
-}
-
/// \brief Used to prune the decls of Sema's UnusedFileScopedDecls vector.
static bool ShouldRemoveFromUnused(Sema *SemaRef, const DeclaratorDecl *D) {
if (D->isUsed())
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 2a9abd4b38..25f1342aeb 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1988,7 +1988,7 @@ Sema::PerformObjectMemberConversion(Expr *From,
SourceRange FromRange = From->getSourceRange();
SourceLocation FromLoc = FromRange.getBegin();
- ExprValueKind VK = CastCategory(From);
+ ExprValueKind VK = From->getValueKind();
// C++ [class.member.lookup]p8:
// [...] Ambiguities can often be resolved by qualifying a name with its
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 412d891a93..946f02c567 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -325,7 +325,7 @@ ExprResult Sema::BuildCXXTypeId(QualType TypeInfoType,
QualType UnqualT = Context.getUnqualifiedArrayType(T, Quals);
if (!Context.hasSameType(T, UnqualT)) {
T = UnqualT;
- E = ImpCastExprToType(E, UnqualT, CK_NoOp, CastCategory(E)).take();
+ E = ImpCastExprToType(E, UnqualT, CK_NoOp, E->getValueKind()).take();
}
}
@@ -545,7 +545,7 @@ ExprResult Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *E,
// or "pointer to function returning T", [...]
if (E->getType().hasQualifiers())
E = ImpCastExprToType(E, E->getType().getUnqualifiedType(), CK_NoOp,
- CastCategory(E)).take();
+ E->getValueKind()).take();
ExprResult Res = DefaultFunctionArrayConversion(E);
if (Res.isInvalid())
@@ -2430,7 +2430,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
return ExprError();
From = ImpCastExprToType(From, ToType.getNonReferenceType(),
- CK_DerivedToBase, CastCategory(From),
+ CK_DerivedToBase, From->getValueKind(),
&BasePath, CCK).take();
break;
}
@@ -2533,7 +2533,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
// The qualification keeps the category of the inner expression, unless the
// target type isn't a reference.
ExprValueKind VK = ToType->isReferenceType() ?
- CastCategory(From) : VK_RValue;
+ From->getValueKind() : VK_RValue;
From = ImpCastExprToType(From, ToType.getNonLValueExprType(Context),
CK_NoOp, VK, /*BasePath=*/0, CCK).take();
@@ -3339,8 +3339,7 @@ QualType Sema::CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS,
}
// Cast LHS to type of use.
QualType UseType = isIndirect ? Context.getPointerType(Class) : Class;
- ExprValueKind VK =
- isIndirect ? VK_RValue : CastCategory(LHS.get());
+ ExprValueKind VK = isIndirect ? VK_RValue : LHS.get()->getValueKind();
CXXCastPath BasePath;
BuildBasePathArray(Paths, BasePath);
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index e61fe2d519..451abd4534 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -4783,7 +4783,7 @@ InitializationSequence::Perform(Sema &S,
case SK_ObjCObjectConversion:
CurInit = S.ImpCastExprToType(CurInit.take(), Step->Type,
CK_ObjCObjectLValueCast,
- S.CastCategory(CurInit.get()));
+ CurInit.get()->getValueKind());
break;
case SK_ArrayInit:
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 594b7b24fb..d283b6d234 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -3904,7 +3904,8 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
bool ObjCLifetimeConversion;
if (IsQualificationConversion(ArgType, ParamType.getNonReferenceType(),
false, ObjCLifetimeConversion)) {
- Arg = ImpCastExprToType(Arg, ParamType, CK_NoOp, CastCategory(Arg)).take();
+ Arg = ImpCastExprToType(Arg, ParamType, CK_NoOp,
+ Arg->getValueKind()).take();
} else if (!Context.hasSameUnqualifiedType(ArgType,
ParamType.getNonReferenceType())) {
// We can't perform this conversion.
@@ -3975,7 +3976,8 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
// Types match exactly: nothing more to do here.
} else if (IsQualificationConversion(ArgType, ParamType, false,
ObjCLifetimeConversion)) {
- Arg = ImpCastExprToType(Arg, ParamType, CK_NoOp, CastCategory(Arg)).take();
+ Arg = ImpCastExprToType(Arg, ParamType, CK_NoOp,
+ Arg->getValueKind()).take();
} else {
// We can't perform this conversion.
Diag(Arg->getSourceRange().getBegin(),