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
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index f0aea43..f7fce85 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -217,7 +217,8 @@
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 e1684ae..afe539c 100644
--- a/lib/Sema/SemaCXXCast.cpp
+++ b/lib/Sema/SemaCXXCast.cpp
@@ -123,7 +123,8 @@
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 @@
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 01875bb..4c310aa 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -5169,7 +5169,9 @@
// 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 9edf259..b311cf7 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3075,8 +3075,8 @@
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 dc16dda..8ff2840 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -207,8 +207,9 @@
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 2ec318c..ff3b4ef 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -2335,6 +2335,7 @@
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 31c184f..a09e24a 100644
--- a/lib/Sema/SemaTemplateInstantiateExpr.cpp
+++ b/lib/Sema/SemaTemplateInstantiateExpr.cpp
@@ -856,6 +856,7 @@
ImplicitCastExpr *ICE =
new (SemaRef.Context) ImplicitCastExpr(E->getType(),
+ E->getCastKind(),
(Expr *)SubExpr.release(),
E->isLvalueCast());
return SemaRef.Owned(ICE);