diff options
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/Sema.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/Sema/Sema.h | 1 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 1 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 7 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 5 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 2 | 
9 files changed, 29 insertions, 12 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 2bb1ed8ce91..62fbe947465 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -158,7 +158,9 @@ Sema::~Sema() {  /// If there is already an implicit cast, merge into the existing one.  /// If isLvalue, the result of the cast is an lvalue.  void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty, -                             CastExpr::CastKind Kind, bool isLvalue) { +                             CastExpr::CastKind Kind,  +                             CastExpr::CXXBaseVector *InheritancePath, +                             bool isLvalue) {    QualType ExprTy = Context.getCanonicalType(Expr->getType());    QualType TypeTy = Context.getCanonicalType(Ty); @@ -178,13 +180,15 @@ void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,    if (ImplicitCastExpr *ImpCast = dyn_cast<ImplicitCastExpr>(Expr)) {      if (ImpCast->getCastKind() == Kind) { +      assert(!InheritancePath && "FIXME: Merge paths!");        ImpCast->setType(Ty);        ImpCast->setLvalueCast(isLvalue);        return;      }    } -  Expr = new (Context) ImplicitCastExpr(Ty, Kind, Expr, isLvalue); +  Expr = new (Context) ImplicitCastExpr(Ty, Kind, Expr, InheritancePath, +                                        isLvalue);  }  void Sema::DeleteExpr(ExprTy *E) { diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h index 65f7444a00f..1065fc4fa81 100644 --- a/clang/lib/Sema/Sema.h +++ b/clang/lib/Sema/Sema.h @@ -3958,6 +3958,7 @@ public:    /// cast.  If there is already an implicit cast, merge into the existing one.    /// If isLvalue, the result of the cast is an lvalue.    void ImpCastExprToType(Expr *&Expr, QualType Type, CastExpr::CastKind Kind, +                         CastExpr::CXXBaseVector *InheritancePath = 0,                           bool isLvalue = false);    // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 5056e3172b5..0b66c109c06 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -432,7 +432,8 @@ bool Sema::SemaBuiltinAtomicOverloaded(CallExpr *TheCall) {      // pass in 42.  The 42 gets converted to char.  This is even more strange      // for things like 45.123 -> char, etc.      // FIXME: Do this check. -    ImpCastExprToType(Arg, ValType, Kind, /*isLvalue=*/false); +    ImpCastExprToType(Arg, ValType, Kind, /*InheritancePath=*/0, +                      /*isLvalue=*/false);      TheCall->setArg(i+1, Arg);    } diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 7d2d866828e..4800337383c 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -6518,6 +6518,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,        ECD->setInitExpr(new (Context) ImplicitCastExpr(NewTy,                                                        CastExpr::CK_IntegralCast,                                                        ECD->getInitExpr(), +                                                      /*InheritancePath=*/0,                                                        /*isLvalue=*/false));      if (getLangOptions().CPlusPlus)        // C++ [dcl.enum]p4: Following the closing brace of an diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 7b09ddd75bb..f5ecff81844 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1443,7 +1443,8 @@ Sema::PerformObjectMemberConversion(Expr *&From,        if (PointerConversions)          QType = Context.getPointerType(QType);        ImpCastExprToType(From, QType, CastExpr::CK_UncheckedDerivedToBase, -                        /*isLvalue*/ !PointerConversions); +                        /*FIXME: InheritancePath=*/0, +                        /*isLvalue=*/!PointerConversions);        FromType = QType;        FromRecordType = QRecordType; @@ -1479,6 +1480,7 @@ Sema::PerformObjectMemberConversion(Expr *&From,        if (PointerConversions)          UType = Context.getPointerType(UType);        ImpCastExprToType(From, UType, CastExpr::CK_UncheckedDerivedToBase, +                        /*FIXME: InheritancePath=*/0,                          /*isLvalue*/ !PointerConversions);        FromType = UType;        FromRecordType = URecordType; @@ -1497,7 +1499,8 @@ Sema::PerformObjectMemberConversion(Expr *&From,      return true;    ImpCastExprToType(From, DestType, CastExpr::CK_UncheckedDerivedToBase, -                    /*isLvalue=*/ !PointerConversions); +                    /*FIXME: InheritancePath=*/0, +                    /*isLvalue=*/!PointerConversions);    return false;  } diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 007eecd0e85..6983a1e0d8c 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -341,7 +341,7 @@ Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc,        //   type.        if (T.hasQualifiers()) {          ImpCastExprToType(E, T.getUnqualifiedType(), CastExpr::CK_NoOp, -                          E->isLvalue(Context)); +                          /*InheritancePath=*/0, E->isLvalue(Context));          TyOrExpr = E;        }      } @@ -392,6 +392,7 @@ bool Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E) {    //   or "pointer to function returning T", [...]    if (E->getType().hasQualifiers())      ImpCastExprToType(E, E->getType().getUnqualifiedType(), CastExpr::CK_NoOp, +                      /*InheritancePath=*/0,                        E->isLvalue(Context) == Expr::LV_Valid);    DefaultFunctionArrayConversion(E); @@ -1791,7 +1792,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,      // FIXME: Not sure about lvalue vs rvalue here in the presence of rvalue      // references.      ImpCastExprToType(From, ToType.getNonReferenceType(), -                      CastExpr::CK_NoOp, +                      CastExpr::CK_NoOp, /*InheritancePath=*/0,                        ToType->isLValueReferenceType());      if (SCS.DeprecatedStringLiteralToCharPtr) @@ -1886,7 +1887,8 @@ QualType Sema::CheckPointerToMemberOperands(      // 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); +    ImpCastExprToType(lex, UseType, CastExpr::CK_DerivedToBase,  +                      /*FIXME: InheritancePath=*/0, isLValue);    }    if (isa<CXXZeroInitValueExpr>(rex->IgnoreParens())) { diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index eae5f63efa5..904489cdd9c 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -3467,7 +3467,8 @@ InitializationSequence::Perform(Sema &S,        CurInit = S.Owned(new (S.Context) ImplicitCastExpr(Step->Type,                                                      CastExpr::CK_DerivedToBase, -                                                      (Expr*)CurInit.release(), +                                                    (Expr*)CurInit.release(), +                                                    /*FIXME:InheritancePath=*/0,                                       Step->Kind == SK_CastDerivedToBaseLValue));        break;      } @@ -3587,6 +3588,7 @@ InitializationSequence::Perform(Sema &S,        CurInit = S.Owned(new (S.Context) ImplicitCastExpr(CurInitExpr->getType(),                                                           CastKind,                                                            CurInitExpr, +                                                         /*InheritancePath=*/0,                                                           IsLvalue));        if (RequiresCopy) @@ -3599,7 +3601,7 @@ InitializationSequence::Perform(Sema &S,      case SK_QualificationConversionRValue:        // Perform a qualification conversion; these can never go wrong.        S.ImpCastExprToType(CurInitExpr, Step->Type, -                          CastExpr::CK_NoOp,  +                          CastExpr::CK_NoOp, /*InheritancePath=*/0,                            Step->Kind == SK_QualificationConversionLValue);        CurInit.release();        CurInit = S.Owned(CurInitExpr); diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 2e35adb5124..732b9ee3ebc 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -2675,7 +2675,7 @@ Sema::PerformObjectArgumentInitialization(Expr *&From,      return PerformObjectMemberConversion(From, Qualifier, FoundDecl, Method);    if (!Context.hasSameType(From->getType(), DestType)) -    ImpCastExprToType(From, DestType, CastExpr::CK_NoOp, +    ImpCastExprToType(From, DestType, CastExpr::CK_NoOp, /*InheritancePath=*/0,                        /*isLvalue=*/!From->getType()->getAs<PointerType>());    return false;  } @@ -3157,7 +3157,7 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion,                              From->getLocStart());    ImplicitCastExpr ConversionFn(Context.getPointerType(Conversion->getType()),                                  CastExpr::CK_FunctionToPointerDecay, -                                &ConversionRef, false); +                                &ConversionRef, /*InheritancePath=*/0, false);    // Note that it is safe to allocate CallExpr on the stack here because    // there are 0 arguments (i.e., nothing is allocated using ASTContext's @@ -6860,6 +6860,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,      return new (Context) ImplicitCastExpr(ICE->getType(),                                             ICE->getCastKind(),                                            SubExpr, +                                          /*InheritancePath=*/0,                                            ICE->isLvalueCast());    }  diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index a239a41e4ef..7a3e83a4979 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2868,6 +2868,7 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,      if (IsQualificationConversion(ArgType, ParamType.getNonReferenceType())) {        ImpCastExprToType(Arg, ParamType, CastExpr::CK_NoOp, +                        /*InheritancePath=*/0,                          Arg->isLvalue(Context) == Expr::LV_Valid);      } else if (!Context.hasSameUnqualifiedType(ArgType,                                             ParamType.getNonReferenceType())) { @@ -2932,6 +2933,7 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,      // Types match exactly: nothing more to do here.    } else if (IsQualificationConversion(ArgType, ParamType)) {      ImpCastExprToType(Arg, ParamType, CastExpr::CK_NoOp, +                      /*InheritancePath=*/0,                        Arg->isLvalue(Context) == Expr::LV_Valid);    } else {      // We can't perform this conversion.  | 

