Deleted Added
full compact
66,67c66,68
< // If this is an unevaluated operand, clear out the set of declaration
< // references we have been computing.
---
> // If this is an unevaluated operand, clear out the set of
> // declaration references we have been computing and eliminate any
> // temporaries introduced in its computation.
69c70
< PotentiallyReferencedDeclStack.back().clear();
---
> ExprEvalContexts.back().Context = Unevaluated;
329c330
<
---
>
397c398
<
---
>
405c406,423
<
---
> llvm::SmallVector<Expr *, 8> AllPlaceArgs;
> if (OperatorNew) {
> // Add default arguments, if any.
> const FunctionProtoType *Proto =
> OperatorNew->getType()->getAs<FunctionProtoType>();
> VariadicCallType CallType =
> Proto->isVariadic() ? VariadicFunction : VariadicDoesNotApply;
> bool Invalid = GatherArgumentsForCall(PlacementLParen, OperatorNew,
> Proto, 1, PlaceArgs, NumPlaceArgs,
> AllPlaceArgs, CallType);
> if (Invalid)
> return ExprError();
>
> NumPlaceArgs = AllPlaceArgs.size();
> if (NumPlaceArgs > 0)
> PlaceArgs = &AllPlaceArgs[0];
> }
>
605c623,625
< for (unsigned i = 0; i < NumArgs; ++i) {
---
> // Whatch out for variadic allocator function.
> unsigned NumArgsInFnDecl = FnDecl->getNumParams();
> for (unsigned i = 0; (i < NumArgs && i < NumArgsInFnDecl); ++i) {
830,831c850
< OverloadedFunctionDecl *Conversions =
< RD->getVisibleConversionFunctions();
---
> const UnresolvedSet *Conversions = RD->getVisibleConversionFunctions();
833,836c852,853
< for (OverloadedFunctionDecl::function_iterator
< Func = Conversions->function_begin(),
< FuncEnd = Conversions->function_end();
< Func != FuncEnd; ++Func) {
---
> for (UnresolvedSet::iterator I = Conversions->begin(),
> E = Conversions->end(); I != E; ++I) {
838c855
< if (isa<FunctionTemplateDecl>(*Func))
---
> if (isa<FunctionTemplateDecl>(*I))
841c858
< CXXConversionDecl *Conv = cast<CXXConversionDecl>(*Func);
---
> CXXConversionDecl *Conv = cast<CXXConversionDecl>(*I);
929a947,961
> /// \brief Check the use of the given variable as a C++ condition in an if,
> /// while, do-while, or switch statement.
> Action::OwningExprResult Sema::CheckConditionVariable(VarDecl *ConditionVar) {
> QualType T = ConditionVar->getType();
>
> // C++ [stmt.select]p2:
> // The declarator shall not specify a function or an array.
> if (T->isFunctionType())
> return ExprError(Diag(ConditionVar->getLocation(),
> diag::err_invalid_use_of_function_type)
> << ConditionVar->getSourceRange());
> else if (T->isArrayType())
> return ExprError(Diag(ConditionVar->getLocation(),
> diag::err_invalid_use_of_array_type)
> << ConditionVar->getSourceRange());
931,977c963,965
< /// ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a
< /// C++ if/switch/while/for statement.
< /// e.g: "if (int x = f()) {...}"
< Action::OwningExprResult
< Sema::ActOnCXXConditionDeclarationExpr(Scope *S, SourceLocation StartLoc,
< Declarator &D,
< SourceLocation EqualLoc,
< ExprArg AssignExprVal) {
< assert(AssignExprVal.get() && "Null assignment expression");
<
< // C++ 6.4p2:
< // The declarator shall not specify a function or an array.
< // The type-specifier-seq shall not contain typedef and shall not declare a
< // new class or enumeration.
<
< assert(D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_typedef &&
< "Parser allowed 'typedef' as storage class of condition decl.");
<
< // FIXME: Store DeclaratorInfo in the expression.
< DeclaratorInfo *DInfo = 0;
< TagDecl *OwnedTag = 0;
< QualType Ty = GetTypeForDeclarator(D, S, &DInfo, &OwnedTag);
<
< if (Ty->isFunctionType()) { // The declarator shall not specify a function...
< // We exit without creating a CXXConditionDeclExpr because a FunctionDecl
< // would be created and CXXConditionDeclExpr wants a VarDecl.
< return ExprError(Diag(StartLoc, diag::err_invalid_use_of_function_type)
< << SourceRange(StartLoc, EqualLoc));
< } else if (Ty->isArrayType()) { // ...or an array.
< Diag(StartLoc, diag::err_invalid_use_of_array_type)
< << SourceRange(StartLoc, EqualLoc);
< } else if (OwnedTag && OwnedTag->isDefinition()) {
< // The type-specifier-seq shall not declare a new class or enumeration.
< Diag(OwnedTag->getLocation(), diag::err_type_defined_in_condition);
< }
<
< DeclPtrTy Dcl = ActOnDeclarator(S, D);
< if (!Dcl)
< return ExprError();
< AddInitializerToDecl(Dcl, move(AssignExprVal), /*DirectInit=*/false);
<
< // Mark this variable as one that is declared within a conditional.
< // We know that the decl had to be a VarDecl because that is the only type of
< // decl that can be assigned and the grammar requires an '='.
< VarDecl *VD = cast<VarDecl>(Dcl.getAs<Decl>());
< VD->setDeclaredInCondition(true);
< return Owned(new (Context) CXXConditionDeclExpr(StartLoc, EqualLoc, VD));
---
> return Owned(DeclRefExpr::Create(Context, 0, SourceRange(), ConditionVar,
> ConditionVar->getLocation(),
> ConditionVar->getType().getNonReferenceType()));
1131c1119
< if (!ICS.UserDefined.EllipsisConversion)
---
> if (!ICS.UserDefined.EllipsisConversion) {
1135c1123,1124
< BeforeToType = Ctor->getParamDecl(0)->getType();
---
> BeforeToType = Ctor->getParamDecl(0)->getType().getNonReferenceType();
> }
1155c1144,1148
<
---
>
> From = CastArg.takeAs<Expr>();
>
> // FIXME: This and the following if statement shouldn't be necessary, but
> // there's some nasty stuff involving MaybeBindToTemporary going on here.
1158d1150
< From = CastArg.takeAs<Expr>();
1161,1169c1153,1162
<
< if (ICS.UserDefined.After.Second == ICK_Pointer_Member &&
< ToType.getNonReferenceType()->isMemberFunctionPointerType())
< CastKind = CastExpr::CK_BaseToDerivedMemberPointer;
<
< From = new (Context) ImplicitCastExpr(ToType.getNonReferenceType(),
< CastKind, CastArg.takeAs<Expr>(),
< ToType->isLValueReferenceType());
< return false;
---
>
> if (ICS.UserDefined.After.CopyConstructor) {
> From = new (Context) ImplicitCastExpr(ToType.getNonReferenceType(),
> CastKind, From,
> ToType->isLValueReferenceType());
> return false;
> }
>
> return PerformImplicitConversion(From, ToType, ICS.UserDefined.After,
> "converting", IgnoreBaseAccess);
1336,1337c1329,1334
< case ICK_Boolean_Conversion:
< ImpCastExprToType(From, Context.BoolTy, CastExpr::CK_Unknown);
---
> case ICK_Boolean_Conversion: {
> CastExpr::CastKind Kind = CastExpr::CK_Unknown;
> if (FromType->isMemberPointerType())
> Kind = CastExpr::CK_MemberPointerToBoolean;
>
> ImpCastExprToType(From, Context.BoolTy, Kind);
1338a1336
> }
2133a2132,2134
>
> if (BaseType->isPointerType())
> BaseType = BaseType->getPointeeType();
2136,2138d2136
< if (BaseType->isPointerType())
< BaseType = BaseType->getPointeeType();
<
2178,2181c2176,2179
< CXXMemberCallExpr *CE =
< new (Context) CXXMemberCallExpr(Context, ME, 0, 0,
< ResultType,
< Exp->getLocEnd());
---
> MarkDeclarationReferenced(Exp->getLocStart(), Method);
> CXXMemberCallExpr *CE =
> new (Context) CXXMemberCallExpr(Context, ME, 0, 0, ResultType,
> Exp->getLocEnd());
2241,2243d2238
< /// \param SS if non-NULL, the C++ nested-name-specifier that precedes the
< /// name of the declaration referenced.
< ///
2252,2255d2246
< /// \param MemberType if the reference to this declaration is an implicit
< /// member access, will be set to the type of the member being referenced
< /// (for use at the type of the resulting member access expression).
< ///
2259,2261c2250,2251
< bool Sema::isImplicitMemberReference(const CXXScopeSpec *SS, NamedDecl *D,
< SourceLocation NameLoc, QualType &ThisType,
< QualType &MemberType) {
---
> bool Sema::isImplicitMemberReference(const LookupResult &R,
> QualType &ThisType) {
2274c2264,2267
< if (FieldDecl *FD = dyn_cast<FieldDecl>(D)) {
---
> if (R.isUnresolvableResult()) {
> // FIXME: this is just picking one at random
> Ctx = R.getRepresentativeDecl()->getDeclContext();
> } else if (FieldDecl *FD = R.getAsSingle<FieldDecl>()) {
2276,2283d2268
< MemberType = FD->getType();
<
< if (const ReferenceType *RefType = MemberType->getAs<ReferenceType>())
< MemberType = RefType->getPointeeType();
< else if (!FD->isMutable())
< MemberType
< = Context.getQualifiedType(MemberType,
< Qualifiers::fromCVRMask(MD->getTypeQualifiers()));
2285,2286c2270,2271
< for (OverloadIterator Ovl(D), OvlEnd; Ovl != OvlEnd; ++Ovl) {
< CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(*Ovl);
---
> for (LookupResult::iterator I = R.begin(), E = R.end(); I != E; ++I) {
> CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(*I);
2288c2273
< if (!Method && (FunTmpl = dyn_cast<FunctionTemplateDecl>(*Ovl)))
---
> if (!Method && (FunTmpl = dyn_cast<FunctionTemplateDecl>(*I)))
2294,2297d2278
< if (isa<CXXMethodDecl>(D) && !FunTmpl)
< MemberType = Method->getType();
< else
< MemberType = Context.OverloadTy;
2308a2290,2291
>
> // FIXME: this doesn't really work for overloaded lookups.
2310,2314d2292
< // If the type of "this" is dependent, we can't tell if the member is in a
< // base class or not, so treat this as a dependent implicit member reference.
< if (ThisType->isDependentType())
< return true;
<