Deleted Added
full compact
SemaExprCXX.cpp (195099) SemaExprCXX.cpp (195341)
1//===--- SemaExprCXX.cpp - Semantic Analysis for Expressions --------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 538 unchanged lines hidden (view full) ---

547/// FindAllocationOverload - Find an fitting overload for the allocation
548/// function in the specified scope.
549bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
550 DeclarationName Name, Expr** Args,
551 unsigned NumArgs, DeclContext *Ctx,
552 bool AllowMissing, FunctionDecl *&Operator)
553{
554 DeclContext::lookup_iterator Alloc, AllocEnd;
1//===--- SemaExprCXX.cpp - Semantic Analysis for Expressions --------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 538 unchanged lines hidden (view full) ---

547/// FindAllocationOverload - Find an fitting overload for the allocation
548/// function in the specified scope.
549bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
550 DeclarationName Name, Expr** Args,
551 unsigned NumArgs, DeclContext *Ctx,
552 bool AllowMissing, FunctionDecl *&Operator)
553{
554 DeclContext::lookup_iterator Alloc, AllocEnd;
555 llvm::tie(Alloc, AllocEnd) = Ctx->lookup(Context, Name);
555 llvm::tie(Alloc, AllocEnd) = Ctx->lookup(Name);
556 if (Alloc == AllocEnd) {
557 if (AllowMissing)
558 return false;
559 return Diag(StartLoc, diag::err_ovl_no_viable_function_in_call)
560 << Name << Range;
561 }
562
563 OverloadCandidateSet Candidates;

--- 88 unchanged lines hidden (view full) ---

652void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
653 QualType Return, QualType Argument)
654{
655 DeclContext *GlobalCtx = Context.getTranslationUnitDecl();
656
657 // Check if this function is already declared.
658 {
659 DeclContext::lookup_iterator Alloc, AllocEnd;
556 if (Alloc == AllocEnd) {
557 if (AllowMissing)
558 return false;
559 return Diag(StartLoc, diag::err_ovl_no_viable_function_in_call)
560 << Name << Range;
561 }
562
563 OverloadCandidateSet Candidates;

--- 88 unchanged lines hidden (view full) ---

652void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
653 QualType Return, QualType Argument)
654{
655 DeclContext *GlobalCtx = Context.getTranslationUnitDecl();
656
657 // Check if this function is already declared.
658 {
659 DeclContext::lookup_iterator Alloc, AllocEnd;
660 for (llvm::tie(Alloc, AllocEnd) = GlobalCtx->lookup(Context, Name);
660 for (llvm::tie(Alloc, AllocEnd) = GlobalCtx->lookup(Name);
661 Alloc != AllocEnd; ++Alloc) {
662 // FIXME: Do we need to check for default arguments here?
663 FunctionDecl *Func = cast<FunctionDecl>(*Alloc);
664 if (Func->getNumParams() == 1 &&
665 Context.getCanonicalType(Func->getParamDecl(0)->getType())==Argument)
666 return;
667 }
668 }

--- 6 unchanged lines hidden (view full) ---

675 Alloc->setImplicit();
676 ParmVarDecl *Param = ParmVarDecl::Create(Context, Alloc, SourceLocation(),
677 0, Argument, VarDecl::None, 0);
678 Alloc->setParams(Context, &Param, 1);
679
680 // FIXME: Also add this declaration to the IdentifierResolver, but
681 // make sure it is at the end of the chain to coincide with the
682 // global scope.
661 Alloc != AllocEnd; ++Alloc) {
662 // FIXME: Do we need to check for default arguments here?
663 FunctionDecl *Func = cast<FunctionDecl>(*Alloc);
664 if (Func->getNumParams() == 1 &&
665 Context.getCanonicalType(Func->getParamDecl(0)->getType())==Argument)
666 return;
667 }
668 }

--- 6 unchanged lines hidden (view full) ---

675 Alloc->setImplicit();
676 ParmVarDecl *Param = ParmVarDecl::Create(Context, Alloc, SourceLocation(),
677 0, Argument, VarDecl::None, 0);
678 Alloc->setParams(Context, &Param, 1);
679
680 // FIXME: Also add this declaration to the IdentifierResolver, but
681 // make sure it is at the end of the chain to coincide with the
682 // global scope.
683 ((DeclContext *)TUScope->getEntity())->addDecl(Context, Alloc);
683 ((DeclContext *)TUScope->getEntity())->addDecl(Alloc);
684}
685
686/// ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
687/// @code ::delete ptr; @endcode
688/// or
689/// @code delete [] ptr; @endcode
690Action::OwningExprResult
691Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,

--- 870 unchanged lines hidden (view full) ---

1562
1563 CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
1564 if (RD->hasTrivialDestructor())
1565 return Owned(E);
1566
1567 CXXTemporary *Temp = CXXTemporary::Create(Context,
1568 RD->getDestructor(Context));
1569 ExprTemporaries.push_back(Temp);
684}
685
686/// ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
687/// @code ::delete ptr; @endcode
688/// or
689/// @code delete [] ptr; @endcode
690Action::OwningExprResult
691Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,

--- 870 unchanged lines hidden (view full) ---

1562
1563 CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
1564 if (RD->hasTrivialDestructor())
1565 return Owned(E);
1566
1567 CXXTemporary *Temp = CXXTemporary::Create(Context,
1568 RD->getDestructor(Context));
1569 ExprTemporaries.push_back(Temp);
1570 MarcDestructorReferenced(E->getExprLoc(), E->getType());
1570 MarkDestructorReferenced(E->getExprLoc(), E->getType());
1571 // FIXME: Add the temporary to the temporaries vector.
1572 return Owned(CXXBindTemporaryExpr::Create(Context, Temp, E));
1573}
1574
1575// FIXME: This doesn't handle casts yet.
1576Expr *Sema::RemoveOutermostTemporaryBinding(Expr *E) {
1577 const RecordType *RT = E->getType()->getAsRecordType();
1578 if (!RT)

--- 61 unchanged lines hidden ---
1571 // FIXME: Add the temporary to the temporaries vector.
1572 return Owned(CXXBindTemporaryExpr::Create(Context, Temp, E));
1573}
1574
1575// FIXME: This doesn't handle casts yet.
1576Expr *Sema::RemoveOutermostTemporaryBinding(Expr *E) {
1577 const RecordType *RT = E->getType()->getAsRecordType();
1578 if (!RT)

--- 61 unchanged lines hidden ---