aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-07-31 00:48:10 +0000
committerAnders Carlsson <andersca@mac.com>2009-07-31 00:48:10 +0000
commitcdef2b75aa60cde1ca00e0aa3f89139ac89c6ae4 (patch)
tree495c26d02b13cb3150354187e8c586b665e17387 /lib/Sema
parent82ec2e99084996eecbdf3a304f3cbba8c16c2f6b (diff)
Add a CastKind enum to CastExpr. Right now it's not used for much but it will be :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77650 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/Sema.cpp3
-rw-r--r--lib/Sema/SemaCXXCast.cpp6
-rw-r--r--lib/Sema/SemaDecl.cpp4
-rw-r--r--lib/Sema/SemaExpr.cpp4
-rw-r--r--lib/Sema/SemaExprCXX.cpp5
-rw-r--r--lib/Sema/SemaOverload.cpp1
-rw-r--r--lib/Sema/SemaTemplateInstantiateExpr.cpp1
7 files changed, 16 insertions, 8 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index f0aea43047..f7fce8527a 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -217,7 +217,8 @@ void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty, bool isLvalue) {
ImpCast->setType(Ty);
ImpCast->setLvalueCast(isLvalue);
} else
- Expr = new (Context) ImplicitCastExpr(Ty, Expr, isLvalue);
+ Expr = new (Context) ImplicitCastExpr(Ty, CastExpr::CK_Unknown, Expr,
+ isLvalue);
}
void Sema::DeleteExpr(ExprTy *E) {
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp
index e1684ae40c..afe539cd46 100644
--- a/lib/Sema/SemaCXXCast.cpp
+++ b/lib/Sema/SemaCXXCast.cpp
@@ -123,7 +123,8 @@ Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
if (!TypeDependent)
CheckDynamicCast(*this, Ex, DestType, OpRange, DestRange);
return Owned(new (Context)CXXDynamicCastExpr(DestType.getNonReferenceType(),
- Ex, DestType, OpLoc));
+ CastExpr::CK_Unknown, Ex,
+ DestType, OpLoc));
case tok::kw_reinterpret_cast:
if (!TypeDependent)
@@ -136,7 +137,8 @@ Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
if (!TypeDependent)
CheckStaticCast(*this, Ex, DestType, OpRange);
return Owned(new (Context) CXXStaticCastExpr(DestType.getNonReferenceType(),
- Ex, DestType, OpLoc));
+ CastExpr::CK_Unknown, Ex,
+ DestType, OpLoc));
}
return ExprError();
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 01875bbcdf..4c310aaa07 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -5169,7 +5169,9 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
// Adjust the Expr initializer and type.
if (ECD->getInitExpr())
- ECD->setInitExpr(new (Context) ImplicitCastExpr(NewTy, ECD->getInitExpr(),
+ ECD->setInitExpr(new (Context) ImplicitCastExpr(NewTy,
+ CastExpr::CK_Unknown,
+ ECD->getInitExpr(),
/*isLvalue=*/false));
if (getLangOptions().CPlusPlus)
// C++ [dcl.enum]p4: Following the closing brace of an
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 9edf259ae6..b311cf7438 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3075,8 +3075,8 @@ Sema::ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
if (CheckCastTypes(SourceRange(LParenLoc, RParenLoc), castType, castExpr))
return ExprError();
return Owned(new (Context) CStyleCastExpr(castType.getNonReferenceType(),
- castExpr, castType,
- LParenLoc, RParenLoc));
+ CastExpr::CK_Unknown, castExpr,
+ castType, LParenLoc, RParenLoc));
}
/// Note that lhs is not null here, even if this is the gnu "x ?: y" extension.
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index dc16dda9fe..8ff28405e8 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -207,8 +207,9 @@ Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, TypeTy *TypeRep,
return ExprError();
exprs.release();
return Owned(new (Context) CXXFunctionalCastExpr(Ty.getNonReferenceType(),
- Ty, TyBeginLoc, Exprs[0],
- RParenLoc));
+ Ty, TyBeginLoc,
+ CastExpr::CK_Unknown,
+ Exprs[0], RParenLoc));
}
if (const RecordType *RT = Ty->getAs<RecordType>()) {
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 2ec318c48d..ff3b4efe99 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -2335,6 +2335,7 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion,
DeclRefExpr ConversionRef(Conversion, Conversion->getType(),
SourceLocation());
ImplicitCastExpr ConversionFn(Context.getPointerType(Conversion->getType()),
+ CastExpr::CK_Unknown,
&ConversionRef, false);
// Note that it is safe to allocate CallExpr on the stack here because
diff --git a/lib/Sema/SemaTemplateInstantiateExpr.cpp b/lib/Sema/SemaTemplateInstantiateExpr.cpp
index 31c184fbc2..a09e24acf4 100644
--- a/lib/Sema/SemaTemplateInstantiateExpr.cpp
+++ b/lib/Sema/SemaTemplateInstantiateExpr.cpp
@@ -856,6 +856,7 @@ Sema::OwningExprResult TemplateExprInstantiator::VisitImplicitCastExpr(
ImplicitCastExpr *ICE =
new (SemaRef.Context) ImplicitCastExpr(E->getType(),
+ E->getCastKind(),
(Expr *)SubExpr.release(),
E->isLvalueCast());
return SemaRef.Owned(ICE);