Greatly improve static_cast diagnostics
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58873 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 385b174..3645a7f 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -750,12 +750,27 @@
void CheckDynamicCast(Expr *&SrcExpr, QualType DestType,
const SourceRange &OpRange,
const SourceRange &DestRange);
+
+ enum TryStaticCastResult {
+ TSC_NotApplicable, ///< The cast method is not applicable.
+ TSC_Success, ///< The cast method is appropriate and successful.
+ TSC_Failed ///< The cast method is appropriate, but failed. A
+ ///< diagnostic has been emitted.
+ };
+
bool CastsAwayConstness(QualType SrcType, QualType DestType);
- bool IsStaticReferenceDowncast(Expr *SrcExpr, QualType DestType);
- bool IsStaticPointerDowncast(QualType SrcType, QualType DestType);
- bool IsStaticDowncast(QualType SrcType, QualType DestType);
- ImplicitConversionSequence TryDirectInitialization(Expr *SrcExpr,
- QualType DestType);
+ TryStaticCastResult TryStaticReferenceDowncast(Expr *SrcExpr,
+ QualType DestType,
+ const SourceRange &OpRange);
+ TryStaticCastResult TryStaticPointerDowncast(QualType SrcType,
+ QualType DestType,
+ const SourceRange &OpRange);
+ TryStaticCastResult TryStaticDowncast(QualType SrcType, QualType DestType,
+ const SourceRange &OpRange,
+ QualType OrigSrcType,
+ QualType OrigDestType);
+ TryStaticCastResult TryStaticImplicitCast(Expr *SrcExpr, QualType DestType,
+ const SourceRange &OpRange);
public:
//// ActOnCXXThis - Parse 'this' pointer.