First non-embarrassing cut at checking for ambiguous derived-to-base
conversions.
Added PerformImplicitConversion, which follows an implicit conversion sequence
computed by TryCopyInitialization and actually performs the implicit
conversions, including the extra check for ambiguity mentioned above.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58071 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 5a5c99c..ba07a9c 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -23,8 +23,8 @@
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/OwningPtr.h"
-#include <vector>
#include <string>
+#include <vector>
namespace llvm {
class APSInt;
@@ -66,6 +66,7 @@
class ObjCMethodDecl;
class ObjCPropertyDecl;
struct BlockSemaInfo;
+ class BasePaths;
/// PragmaPackStack - Simple class to wrap the stack used by #pragma
/// pack.
@@ -371,6 +372,7 @@
bool IsFloatingPointPromotion(QualType FromType, QualType ToType);
bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
QualType& ConvertedType);
+ bool CheckPointerConversion(Expr *From, QualType ToType);
bool IsQualificationConversion(QualType FromType, QualType ToType);
ImplicitConversionSequence::CompareKind
@@ -785,6 +787,10 @@
unsigned NumBases);
bool IsDerivedFrom(QualType Derived, QualType Base);
+ bool IsDerivedFrom(QualType Derived, QualType Base, BasePaths &Paths);
+
+ bool CheckDerivedToBaseConversion(SourceLocation Loc, SourceRange Range,
+ QualType Derived, QualType Base);
// Objective-C declarations.
virtual DeclTy *ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
@@ -1028,6 +1034,10 @@
QualType rhsType);
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType);
+
+ bool PerformImplicitConversion(Expr *&From, QualType ToType);
+ bool PerformImplicitConversion(Expr *&From, QualType ToType,
+ const StandardConversionSequence& SCS);
/// the following "Check" methods will return a valid/converted QualType
/// or a null QualType (indicating an error diagnostic was issued).