[cfe-commits] r102259 - in /cfe/trunk: include/clang/AST/Expr.h lib/AST/StmtDumper.cpp lib/Sema/Sema.h lib/Sema/SemaCXXCast.cpp lib/Sema/SemaChecking.cpp lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/SemaInit.cpp lib/Sema/SemaOverload.cpp test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp

Anders Carlsson andersca at mac.com
Sat Apr 24 12:06:50 PDT 2010


Author: andersca
Date: Sat Apr 24 14:06:50 2010
New Revision: 102259

URL: http://llvm.org/viewvc/llvm-project?rev=102259&view=rev
Log:
Actually produce base paths for CastExprs of kind CK_DerivedToBase.

Modified:
    cfe/trunk/include/clang/AST/Expr.h
    cfe/trunk/lib/AST/StmtDumper.cpp
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaCXXCast.cpp
    cfe/trunk/lib/Sema/SemaChecking.cpp
    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
    cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=102259&r1=102258&r2=102259&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Sat Apr 24 14:06:50 2010
@@ -1658,9 +1658,12 @@
   void CheckBasePath() const {
 #ifndef NDEBUG
     switch (getCastKind()) {
+    case CK_DerivedToBase:
+      assert(!BasePath.empty() && "Cast kind should have a base path!");
+      break;
+
     // FIXME: We should add inheritance paths for these.
     case CK_BaseToDerived:
-    case CK_DerivedToBase:
     case CK_UncheckedDerivedToBase:
     case CK_BaseToDerivedMemberPointer:
     case CK_DerivedToBaseMemberPointer:
@@ -1687,7 +1690,7 @@
     case CK_MemberPointerToBoolean:
     case CK_AnyPointerToObjCPointerCast:
     case CK_AnyPointerToBlockPointerCast:
-      assert(BasePath.empty() && "Cast kind shoudl not have a base path!");
+      assert(BasePath.empty() && "Cast kind should not have a base path!");
       break;
     }
 #endif

Modified: cfe/trunk/lib/AST/StmtDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtDumper.cpp?rev=102259&r1=102258&r2=102259&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtDumper.cpp (original)
+++ cfe/trunk/lib/AST/StmtDumper.cpp Sat Apr 24 14:06:50 2010
@@ -300,9 +300,35 @@
   DumpExpr(Node);
 }
 
+static void DumpBasePath(llvm::raw_ostream &OS, CastExpr *Node) {
+  if (Node->getBasePath().empty())
+    return;
+
+  OS << " (";
+  bool First = true;
+  for (CXXBaseSpecifierArray::iterator I = Node->getBasePath().begin(),
+       E = Node->getBasePath().end(); I != E; ++I) {
+    const CXXBaseSpecifier *Base = *I;
+    if (!First)
+      OS << " -> ";
+    
+    const CXXRecordDecl *RD =
+    cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
+    
+    if (Base->isVirtual())
+      OS << "virtual ";
+    OS << RD->getName();
+    First = false;
+  }
+    
+  OS << ')';
+}
+
 void StmtDumper::VisitCastExpr(CastExpr *Node) {
   DumpExpr(Node);
-  OS << " <" << Node->getCastKindName() << ">";
+  OS << " <" << Node->getCastKindName();
+  DumpBasePath(OS, Node);
+  OS << ">";
 }
 
 void StmtDumper::VisitImplicitCastExpr(ImplicitCastExpr *Node) {
@@ -452,7 +478,9 @@
   DumpExpr(Node);
   OS << " " << Node->getCastName() 
      << "<" << Node->getTypeAsWritten().getAsString() << ">"
-     << " <" << Node->getCastKindName() << ">";
+     << " <" << Node->getCastKindName();
+  DumpBasePath(OS, Node);
+  OS << ">";
 }
 
 void StmtDumper::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node) {

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=102259&r1=102258&r2=102259&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Sat Apr 24 14:06:50 2010
@@ -1087,6 +1087,7 @@
                                QualType& ConvertedType, bool &IncompatibleObjC);
   bool CheckPointerConversion(Expr *From, QualType ToType,
                               CastExpr::CastKind &Kind,
+                              CXXBaseSpecifierArray& BasePath,
                               bool IgnoreBaseAccess);
   bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType,
                                  bool InOverloadResolution,
@@ -2593,7 +2594,11 @@
 
   bool IsDerivedFrom(QualType Derived, QualType Base);
   bool IsDerivedFrom(QualType Derived, QualType Base, CXXBasePaths &Paths);
-  
+
+  // FIXME: I don't like this name.
+  void BuildBasePathArray(const CXXBasePaths &Paths,
+                          CXXBaseSpecifierArray &BasePath);
+
   bool CheckDerivedToBaseConversion(QualType Derived, QualType Base,
                                     SourceLocation Loc, SourceRange Range,
                                     CXXBaseSpecifierArray *BasePath = 0,
@@ -4227,7 +4232,7 @@
   /// CheckCastTypes - Check type constraints for casting between types under
   /// C semantics, or forward to CXXCheckCStyleCast in C++.
   bool CheckCastTypes(SourceRange TyRange, QualType CastTy, Expr *&CastExpr,
-                      CastExpr::CastKind &Kind,
+                      CastExpr::CastKind &Kind, CXXBaseSpecifierArray &BasePath,
                       bool FunctionalStyle = false);
 
   // CheckVectorCast - check type constraints for vectors.
@@ -4248,7 +4253,9 @@
   /// CXXCheckCStyleCast - Check constraints of a C-style or function-style
   /// cast under C++ semantics.
   bool CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr,
-                          CastExpr::CastKind &Kind, bool FunctionalStyle);
+                          CastExpr::CastKind &Kind, 
+                          CXXBaseSpecifierArray &BasePath,
+                          bool FunctionalStyle);
 
   /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
   /// \param Method - May be null.

Modified: cfe/trunk/lib/Sema/SemaCXXCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXCast.cpp?rev=102259&r1=102258&r2=102259&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXCast.cpp Sat Apr 24 14:06:50 2010
@@ -46,11 +46,13 @@
                                  CastExpr::CastKind &Kind);
 static void CheckStaticCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
                             const SourceRange &OpRange,
-                            CastExpr::CastKind &Kind);
+                            CastExpr::CastKind &Kind,
+                            CXXBaseSpecifierArray &BasePath);
 static void CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
                              const SourceRange &OpRange,
                              const SourceRange &DestRange,
-                             CastExpr::CastKind &Kind);
+                             CastExpr::CastKind &Kind,
+                             CXXBaseSpecifierArray &BasePath);
 
 static bool CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType);
 
@@ -98,7 +100,8 @@
                                    QualType DestType, bool CStyle,
                                    const SourceRange &OpRange,
                                    unsigned &msg,
-                                   CastExpr::CastKind &Kind);
+                                   CastExpr::CastKind &Kind,
+                                   CXXBaseSpecifierArray &BasePath);
 static TryCastResult TryConstCast(Sema &Self, Expr *SrcExpr, QualType DestType,
                                   bool CStyle, unsigned &msg);
 static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
@@ -150,30 +153,27 @@
 
   case tok::kw_dynamic_cast: {
     CastExpr::CastKind Kind = CastExpr::CK_Unknown;
-    // FIXME: Initialize base path!
     CXXBaseSpecifierArray BasePath;
     if (!TypeDependent)
-      CheckDynamicCast(*this, Ex, DestType, OpRange, DestRange, Kind);
+      CheckDynamicCast(*this, Ex, DestType, OpRange, DestRange, Kind, BasePath);
     return Owned(new (Context)CXXDynamicCastExpr(DestType.getNonReferenceType(),
                                                  Kind, Ex, BasePath, DestTInfo,
                                                  OpLoc));
   }
   case tok::kw_reinterpret_cast: {
     CastExpr::CastKind Kind = CastExpr::CK_Unknown;
-    // FIXME: Initialize base path!
-    CXXBaseSpecifierArray BasePath;
     if (!TypeDependent)
       CheckReinterpretCast(*this, Ex, DestType, OpRange, DestRange, Kind);
     return Owned(new (Context) CXXReinterpretCastExpr(
                                   DestType.getNonReferenceType(),
-                                  Kind, Ex, BasePath, DestTInfo, OpLoc));
+                                  Kind, Ex, CXXBaseSpecifierArray(), 
+                                  DestTInfo, OpLoc));
   }
   case tok::kw_static_cast: {
     CastExpr::CastKind Kind = CastExpr::CK_Unknown;
-    // FIXME: Initialize base path!
     CXXBaseSpecifierArray BasePath;
     if (!TypeDependent)
-      CheckStaticCast(*this, Ex, DestType, OpRange, Kind);
+      CheckStaticCast(*this, Ex, DestType, OpRange, Kind, BasePath);
     
     return Owned(new (Context) CXXStaticCastExpr(DestType.getNonReferenceType(),
                                                  Kind, Ex, BasePath,
@@ -282,7 +282,8 @@
 static void
 CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
                  const SourceRange &OpRange,
-                 const SourceRange &DestRange, CastExpr::CastKind &Kind) {
+                 const SourceRange &DestRange, CastExpr::CastKind &Kind,
+                 CXXBaseSpecifierArray &BasePath) {
   QualType OrigDestType = DestType, OrigSrcType = SrcExpr->getType();
   DestType = Self.Context.getCanonicalType(DestType);
 
@@ -376,10 +377,12 @@
   // C++ 5.2.7p5
   // Upcasts are resolved statically.
   if (DestRecord && Self.IsDerivedFrom(SrcPointee, DestPointee)) {
-    Self.CheckDerivedToBaseConversion(SrcPointee, DestPointee,
-                                      OpRange.getBegin(), OpRange);
+    if (Self.CheckDerivedToBaseConversion(SrcPointee, DestPointee,
+                                           OpRange.getBegin(), OpRange, 
+                                           &BasePath))
+        return;
+        
     Kind = CastExpr::CK_DerivedToBase;
-    // Diagnostic already emitted on error.
     return;
   }
 
@@ -439,7 +442,8 @@
 /// implicit conversions explicit and getting rid of data loss warnings.
 void
 CheckStaticCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
-                const SourceRange &OpRange, CastExpr::CastKind &Kind) {
+                const SourceRange &OpRange, CastExpr::CastKind &Kind,
+                CXXBaseSpecifierArray &BasePath) {
   // This test is outside everything else because it's the only case where
   // a non-lvalue-reference target type does not lead to decay.
   // C++ 5.2.9p4: Any expression can be explicitly converted to type "cv void".
@@ -453,8 +457,7 @@
 
   unsigned msg = diag::err_bad_cxx_cast_generic;
   if (TryStaticCast(Self, SrcExpr, DestType, /*CStyle*/false, OpRange, msg,
-                    Kind)
-      != TC_Success && msg != 0)
+                    Kind, BasePath) != TC_Success && msg != 0)
     Self.Diag(OpRange.getBegin(), msg) << CT_Static
       << SrcExpr->getType() << DestType << OpRange;
 }
@@ -465,7 +468,8 @@
 static TryCastResult TryStaticCast(Sema &Self, Expr *&SrcExpr,
                                    QualType DestType, bool CStyle,
                                    const SourceRange &OpRange, unsigned &msg,
-                                   CastExpr::CastKind &Kind) {
+                                   CastExpr::CastKind &Kind,
+                                   CXXBaseSpecifierArray &BasePath) {
   // The order the tests is not entirely arbitrary. There is one conversion
   // that can be handled in two different ways. Given:
   // struct A {};
@@ -1189,8 +1193,11 @@
   return TC_Success;
 }
 
-bool Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr,
-                              CastExpr::CastKind &Kind, bool FunctionalStyle) {
+bool 
+Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr,
+                         CastExpr::CastKind &Kind, 
+                         CXXBaseSpecifierArray &BasePath,
+                         bool FunctionalStyle) {
   // This test is outside everything else because it's the only case where
   // a non-lvalue-reference target type does not lead to decay.
   // C++ 5.2.9p4: Any expression can be explicitly converted to type "cv void".
@@ -1225,7 +1232,8 @@
 
   if (tcr == TC_NotApplicable) {
     // ... or if that is not possible, a static_cast, ignoring const, ...
-    tcr = TryStaticCast(*this, CastExpr, CastTy, /*CStyle*/true, R, msg, Kind);
+    tcr = TryStaticCast(*this, CastExpr, CastTy, /*CStyle*/true, R, msg, Kind,
+                        BasePath);
     if (tcr == TC_NotApplicable) {
       // ... and finally a reinterpret_cast, ignoring const.
       tcr = TryReinterpretCast(*this, CastExpr, CastTy, /*CStyle*/true, R, msg,

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=102259&r1=102258&r2=102259&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Sat Apr 24 14:06:50 2010
@@ -423,7 +423,8 @@
     // GCC does an implicit conversion to the pointer or integer ValType.  This
     // can fail in some cases (1i -> int**), check for this error case now.
     CastExpr::CastKind Kind = CastExpr::CK_Unknown;
-    if (CheckCastTypes(Arg->getSourceRange(), ValType, Arg, Kind))
+    CXXBaseSpecifierArray BasePath;
+    if (CheckCastTypes(Arg->getSourceRange(), ValType, Arg, Kind, BasePath))
       return true;
 
     // Okay, we have something that *can* be converted to the right type.  Check

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=102259&r1=102258&r2=102259&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sat Apr 24 14:06:50 2010
@@ -710,6 +710,29 @@
   return DerivedRD->isDerivedFrom(BaseRD, Paths);
 }
 
+void Sema::BuildBasePathArray(const CXXBasePaths &Paths, 
+                              CXXBaseSpecifierArray &BasePathArray) {
+  assert(BasePathArray.empty() && "Base path array must be empty!");
+  assert(Paths.isRecordingPaths() && "Must record paths!");
+  
+  const CXXBasePath &Path = Paths.front();
+       
+  // We first go backward and check if we have a virtual base.
+  // FIXME: It would be better if CXXBasePath had the base specifier for
+  // the nearest virtual base.
+  unsigned Start = 0;
+  for (unsigned I = Path.size(); I != 0; --I) {
+    if (Path[I - 1].Base->isVirtual()) {
+      Start = I - 1;
+      break;
+    }
+  }
+
+  // Now add all bases.
+  for (unsigned I = Start, E = Path.size(); I != E; ++I)
+    BasePathArray.push_back(Path[I].Base);
+}
+
 /// CheckDerivedToBaseConversion - Check whether the Derived-to-Base
 /// conversion (where Derived and Base are class types) is
 /// well-formed, meaning that the conversion is unambiguous (and
@@ -737,23 +760,23 @@
   (void)DerivationOkay;
   
   if (!Paths.isAmbiguous(Context.getCanonicalType(Base).getUnqualifiedType())) {
-    if (!InaccessibleBaseID)
-      return false;
-
-    // Check that the base class can be accessed.
-    switch (CheckBaseClassAccess(Loc, Base, Derived, Paths.front(),
-                                 InaccessibleBaseID)) {
-    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!
+    if (InaccessibleBaseID) {
+      // Check that the base class can be accessed.
+      switch (CheckBaseClassAccess(Loc, Base, Derived, Paths.front(),
+                                   InaccessibleBaseID)) {
+        case AR_inaccessible: 
+          return true;
+        case AR_accessible: 
+        case AR_dependent:
+        case AR_delayed:
+          break;
       }
-      return false;
     }
+    
+    // Build a base path if necessary.
+    if (BasePath)
+      BuildBasePathArray(Paths, *BasePath);
+    return false;
   }
   
   // We know that the derived-to-base conversion is ambiguous, and

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=102259&r1=102258&r2=102259&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Apr 24 14:06:50 2010
@@ -3794,9 +3794,11 @@
 /// CheckCastTypes - Check type constraints for casting between types.
 bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *&castExpr,
                           CastExpr::CastKind& Kind,
+                          CXXBaseSpecifierArray &BasePath,
                           bool FunctionalStyle) {
   if (getLangOptions().CPlusPlus)
-    return CXXCheckCStyleCast(TyR, castType, castExpr, Kind, FunctionalStyle);
+    return CXXCheckCStyleCast(TyR, castType, castExpr, Kind, BasePath,
+                              FunctionalStyle);
 
   DefaultFunctionArrayLvalueConversion(castExpr);
 
@@ -3957,10 +3959,9 @@
   Expr *castExpr = static_cast<Expr*>(Op.get());
 
   CastExpr::CastKind Kind = CastExpr::CK_Unknown;
-  // FIXME: Initialize base path!
   CXXBaseSpecifierArray BasePath;
   if (CheckCastTypes(SourceRange(LParenLoc, RParenLoc), Ty->getType(), castExpr,
-                     Kind))
+                     Kind, BasePath))
     return ExprError();
 
   Op.release();

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=102259&r1=102258&r2=102259&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sat Apr 24 14:06:50 2010
@@ -501,9 +501,9 @@
   //
   if (NumExprs == 1) {
     CastExpr::CastKind Kind = CastExpr::CK_Unknown;
-    // FIXME: Initialize base path!
     CXXBaseSpecifierArray BasePath;
-    if (CheckCastTypes(TypeRange, Ty, Exprs[0], Kind, /*FunctionalStyle=*/true))
+    if (CheckCastTypes(TypeRange, Ty, Exprs[0], Kind, BasePath,
+                       /*FunctionalStyle=*/true))
       return ExprError();
 
     exprs.release();
@@ -1745,9 +1745,10 @@
 
     
     CastExpr::CastKind Kind = CastExpr::CK_Unknown;
-    if (CheckPointerConversion(From, ToType, Kind, IgnoreBaseAccess))
+    CXXBaseSpecifierArray BasePath;
+    if (CheckPointerConversion(From, ToType, Kind, BasePath, IgnoreBaseAccess))
       return true;
-    ImpCastExprToType(From, ToType, Kind);
+    ImpCastExprToType(From, ToType, Kind, /*isLvalue=*/false, BasePath);
     break;
   }
   
@@ -1875,7 +1876,7 @@
         << OpSpelling << (int)isIndirect)) {
       return QualType();
     }
-    CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/false,
+    CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true,
                        /*DetectVirtual=*/false);
     // FIXME: Would it be useful to print full ambiguity paths, or is that
     // overkill?
@@ -1888,7 +1889,11 @@
     // Cast LHS to type of use.
     QualType UseType = isIndirect ? Context.getPointerType(Class) : Class;
     bool isLValue = !isIndirect && lex->isLvalue(Context) == Expr::LV_Valid;
-    ImpCastExprToType(lex, UseType, CastExpr::CK_DerivedToBase, isLValue);
+    
+    CXXBaseSpecifierArray BasePath;
+    BuildBasePathArray(Paths, BasePath);
+    ImpCastExprToType(lex, UseType, CastExpr::CK_DerivedToBase, isLValue,
+                      BasePath);
   }
 
   if (isa<CXXZeroInitValueExpr>(rex->IgnoreParens())) {

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=102259&r1=102258&r2=102259&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Sat Apr 24 14:06:50 2010
@@ -3457,18 +3457,20 @@
       // We have a derived-to-base cast that produces either an rvalue or an
       // lvalue. Perform that cast.
       
+      CXXBaseSpecifierArray BasePath;
+
       // Casts to inaccessible base classes are allowed with C-style casts.
       bool IgnoreBaseAccess = Kind.isCStyleOrFunctionalCast();
       if (S.CheckDerivedToBaseConversion(SourceType, Step->Type,
                                          CurInitExpr->getLocStart(),
-                                         CurInitExpr->getSourceRange(), 0,
-                                         IgnoreBaseAccess))
+                                         CurInitExpr->getSourceRange(), 
+                                         &BasePath, IgnoreBaseAccess))
         return S.ExprError();
         
       CurInit = S.Owned(new (S.Context) ImplicitCastExpr(Step->Type,
                                                     CastExpr::CK_DerivedToBase,
                                                     (Expr*)CurInit.release(),
-                                                    CXXBaseSpecifierArray(),
+                                                    BasePath,
                                      Step->Kind == SK_CastDerivedToBaseLValue));
       break;
     }

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=102259&r1=102258&r2=102259&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Sat Apr 24 14:06:50 2010
@@ -1343,6 +1343,7 @@
 /// error, or returns false otherwise.
 bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
                                   CastExpr::CastKind &Kind,
+                                  CXXBaseSpecifierArray& BasePath,
                                   bool IgnoreBaseAccess) {
   QualType FromType = From->getType();
 
@@ -1357,7 +1358,7 @@
         // ambiguous or inaccessible conversion.
         if (CheckDerivedToBaseConversion(FromPointeeType, ToPointeeType,
                                          From->getExprLoc(),
-                                         From->getSourceRange(), 0,
+                                         From->getSourceRange(), &BasePath,
                                          IgnoreBaseAccess))
           return true;
         

Modified: cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp?rev=102259&r1=102258&r2=102259&view=diff
==============================================================================
--- cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp (original)
+++ cfe/trunk/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp Sat Apr 24 14:06:50 2010
@@ -17,11 +17,11 @@
 // CHECK: example1
 void example1() {
   // CHECK: A &ra =
-  // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase> lvalue
+  // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)> lvalue
   A &ra = b;
   // CHECK: A const &rca =
   // CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp>
-  // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase>
+  // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
   const A& rca = b;
 }
 
@@ -35,12 +35,12 @@
 void example2() {
   // CHECK: A const &rca =
   // CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp>
-  // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase>
+  // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
   // CHECK: CallExpr{{.*}}B
   const A &rca = f(); 
   // CHECK: A const &r =
   // CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp>
-  // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase>
+  // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
   // CHECK: CXXMemberCallExpr{{.*}}'struct B'
   const A& r = x;
 }





More information about the cfe-commits mailing list