[cfe-commits] r102250 - in /cfe/trunk/lib/Sema: Sema.h SemaDeclCXX.cpp SemaExpr.cpp SemaExprCXX.cpp SemaInit.cpp SemaOverload.cpp

Anders Carlsson andersca at mac.com
Sat Apr 24 10:11:10 PDT 2010


Author: andersca
Date: Sat Apr 24 12:11:09 2010
New Revision: 102250

URL: http://llvm.org/viewvc/llvm-project?rev=102250&view=rev
Log:
Pass the base specifiers through to CheckDerivedToBaseConversion. No functionality change yet.

Modified:
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaExprCXX.cpp
    cfe/trunk/lib/Sema/SemaInit.cpp
    cfe/trunk/lib/Sema/SemaOverload.cpp

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=102250&r1=102249&r2=102250&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Sat Apr 24 12:11:09 2010
@@ -2596,12 +2596,14 @@
   
   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);
 

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=102250&r1=102249&r2=102250&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sat Apr 24 12:11:09 2010
@@ -723,7 +723,8 @@
                                    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 @@
     // 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 @@
 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 @@
 
     // 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;
     }

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=102250&r1=102249&r2=102250&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Apr 24 12:11:09 2010
@@ -1492,7 +1492,7 @@
   if (CheckDerivedToBaseConversion(FromRecordType,
                                    DestRecordType,
                                    FromLoc,
-                                   FromRange,
+                                   FromRange, 0,
                                    IgnoreAccess))
     return true;
 

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=102250&r1=102249&r2=102250&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sat Apr 24 12:11:09 2010
@@ -1770,7 +1770,7 @@
     if (CheckDerivedToBaseConversion(From->getType(), 
                                      ToType.getNonReferenceType(),
                                      From->getLocStart(),
-                                     From->getSourceRange(),
+                                     From->getSourceRange(), 0,
                                      IgnoreBaseAccess))
       return true;
     ImpCastExprToType(From, ToType.getNonReferenceType(), 

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=102250&r1=102249&r2=102250&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Sat Apr 24 12:11:09 2010
@@ -3461,7 +3461,7 @@
       bool IgnoreBaseAccess = Kind.isCStyleOrFunctionalCast();
       if (S.CheckDerivedToBaseConversion(SourceType, Step->Type,
                                          CurInitExpr->getLocStart(),
-                                         CurInitExpr->getSourceRange(),
+                                         CurInitExpr->getSourceRange(), 0,
                                          IgnoreBaseAccess))
         return S.ExprError();
         

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=102250&r1=102249&r2=102250&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Sat Apr 24 12:11:09 2010
@@ -1357,7 +1357,7 @@
         // ambiguous or inaccessible conversion.
         if (CheckDerivedToBaseConversion(FromPointeeType, ToPointeeType,
                                          From->getExprLoc(),
-                                         From->getSourceRange(),
+                                         From->getSourceRange(), 0,
                                          IgnoreBaseAccess))
           return true;
         





More information about the cfe-commits mailing list