]> granicus.if.org Git - clang/commitdiff
Pass the base specifiers through to CheckDerivedToBaseConversion. No functionality...
authorAnders Carlsson <andersca@mac.com>
Sat, 24 Apr 2010 17:11:09 +0000 (17:11 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 24 Apr 2010 17:11:09 +0000 (17:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102250 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/Sema.h
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaInit.cpp
lib/Sema/SemaOverload.cpp

index 48b12b5712fcd893216c7992c2f9fea08cd4d527..16c7e6c1e37c64ea07a821d5585fa0979425af7a 100644 (file)
@@ -2596,12 +2596,14 @@ public:
   
   bool CheckDerivedToBaseConversion(QualType Derived, QualType Base,
                                     SourceLocation Loc, SourceRange Range,
+                                    CXXBaseSpecifierArray *BasePath = 0,
                                     bool IgnoreAccess = false);
   bool CheckDerivedToBaseConversion(QualType Derived, QualType Base,
                                     unsigned InaccessibleBaseID,
                                     unsigned AmbigiousBaseConvID,
                                     SourceLocation Loc, SourceRange Range,
-                                    DeclarationName Name);
+                                    DeclarationName Name,
+                                    CXXBaseSpecifierArray *BasePath);
 
   std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths);
 
index f1b1244b9e36a964c878b4b1a71c2d8483a4a8ff..243d854a941b76478319188518ec5e037409887c 100644 (file)
@@ -723,7 +723,8 @@ Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
                                    unsigned InaccessibleBaseID,
                                    unsigned AmbigiousBaseConvID,
                                    SourceLocation Loc, SourceRange Range,
-                                   DeclarationName Name) {
+                                   DeclarationName Name,
+                                   CXXBaseSpecifierArray *BasePath) {
   // First, determine whether the path from Derived to Base is
   // ambiguous. This is slightly more expensive than checking whether
   // the Derived to Base conversion exists, because here we need to
@@ -742,10 +743,16 @@ Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
     // Check that the base class can be accessed.
     switch (CheckBaseClassAccess(Loc, Base, Derived, Paths.front(),
                                  InaccessibleBaseID)) {
-    case AR_accessible: return false;
-    case AR_inaccessible: return true;
-    case AR_dependent: return false;
-    case AR_delayed: return false;
+    case AR_inaccessible: 
+      return true;
+    case AR_accessible: 
+    case AR_dependent:
+    case AR_delayed:
+      // Build a base path if necessary.
+      if (BasePath) {
+        // FIXME: Do this!
+      }
+      return false;
     }
   }
   
@@ -775,12 +782,14 @@ Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
 bool
 Sema::CheckDerivedToBaseConversion(QualType Derived, QualType Base,
                                    SourceLocation Loc, SourceRange Range,
+                                   CXXBaseSpecifierArray *BasePath,
                                    bool IgnoreAccess) {
   return CheckDerivedToBaseConversion(Derived, Base,
                                       IgnoreAccess ? 0
                                        : diag::err_upcast_to_inaccessible_base,
                                       diag::err_ambiguous_derived_to_base_conv,
-                                      Loc, Range, DeclarationName());
+                                      Loc, Range, DeclarationName(), 
+                                      BasePath);
 }
 
 
@@ -5418,10 +5427,10 @@ bool Sema::CheckOverridingFunctionReturnType(const CXXMethodDecl *New,
 
     // Check if we the conversion from derived to base is valid.
     if (CheckDerivedToBaseConversion(NewClassTy, OldClassTy,
-                      diag::err_covariant_return_inaccessible_base,
-                      diag::err_covariant_return_ambiguous_derived_to_base_conv,
-                      // FIXME: Should this point to the return type?
-                      New->getLocation(), SourceRange(), New->getDeclName())) {
+                    diag::err_covariant_return_inaccessible_base,
+                    diag::err_covariant_return_ambiguous_derived_to_base_conv,
+                    // FIXME: Should this point to the return type?
+                    New->getLocation(), SourceRange(), New->getDeclName(), 0)) {
       Diag(Old->getLocation(), diag::note_overridden_virtual_function);
       return true;
     }
index 02c41da30b2a07bc6c4967cb549aba8d8373299a..683cd39012ba72acdb714d2a4567497e4e2a301f 100644 (file)
@@ -1492,7 +1492,7 @@ Sema::PerformObjectMemberConversion(Expr *&From,
   if (CheckDerivedToBaseConversion(FromRecordType,
                                    DestRecordType,
                                    FromLoc,
-                                   FromRange,
+                                   FromRange, 0,
                                    IgnoreAccess))
     return true;
 
index 71d891476143d5c3807ddc8f40b2f97dc132852a..e3ffb24d7551441944a2a00398fce3d36a05f89f 100644 (file)
@@ -1770,7 +1770,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
     if (CheckDerivedToBaseConversion(From->getType(), 
                                      ToType.getNonReferenceType(),
                                      From->getLocStart(),
-                                     From->getSourceRange(),
+                                     From->getSourceRange(), 0,
                                      IgnoreBaseAccess))
       return true;
     ImpCastExprToType(From, ToType.getNonReferenceType(), 
index 90c8e3bac6cfb1a83d8df0c554108ca66f6841a8..5887c5e7e46b0005cd461358b5cb5258ea5a2cd4 100644 (file)
@@ -3461,7 +3461,7 @@ InitializationSequence::Perform(Sema &S,
       bool IgnoreBaseAccess = Kind.isCStyleOrFunctionalCast();
       if (S.CheckDerivedToBaseConversion(SourceType, Step->Type,
                                          CurInitExpr->getLocStart(),
-                                         CurInitExpr->getSourceRange(),
+                                         CurInitExpr->getSourceRange(), 0,
                                          IgnoreBaseAccess))
         return S.ExprError();
         
index 50afb7e1bca2fa2e3a34e803ebc0be7e50a401b7..5e5f23352ce6abff7b2c98d26a28290a2d8c1a68 100644 (file)
@@ -1357,7 +1357,7 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
         // ambiguous or inaccessible conversion.
         if (CheckDerivedToBaseConversion(FromPointeeType, ToPointeeType,
                                          From->getExprLoc(),
-                                         From->getSourceRange(),
+                                         From->getSourceRange(), 0,
                                          IgnoreBaseAccess))
           return true;