r181568 - Revert my r181563, breaks tests on buildbots
Dmitri Gribenko
gribozavr at gmail.com
Thu May 9 17:11:18 PDT 2013
Author: gribozavr
Date: Thu May 9 19:11:18 2013
New Revision: 181568
URL: http://llvm.org/viewvc/llvm-project?rev=181568&view=rev
Log:
Revert my r181563, breaks tests on buildbots
Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaExprCXX.cpp
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=181568&r1=181567&r2=181568&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu May 9 19:11:18 2013
@@ -3984,8 +3984,8 @@ public:
FunctionDecl *&OperatorNew,
FunctionDecl *&OperatorDelete);
bool FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
- DeclarationName Name, MultiExprArg Args,
- DeclContext *Ctx,
+ DeclarationName Name, Expr** Args,
+ unsigned NumArgs, DeclContext *Ctx,
bool AllowMissing, FunctionDecl *&Operator,
bool Diagnose = true);
void DeclareGlobalNewDelete();
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=181568&r1=181567&r2=181568&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu May 9 19:11:18 2013
@@ -1561,16 +1561,18 @@ bool Sema::FindAllocationFunctions(Sourc
if (AllocElemType->isRecordType() && !UseGlobal) {
CXXRecordDecl *Record
= cast<CXXRecordDecl>(AllocElemType->getAs<RecordType>()->getDecl());
- if (FindAllocationOverload(StartLoc, Range, NewName, AllocArgs, Record,
- /*AllowMissing=*/true, OperatorNew))
+ if (FindAllocationOverload(StartLoc, Range, NewName, &AllocArgs[0],
+ AllocArgs.size(), Record, /*AllowMissing=*/true,
+ OperatorNew))
return true;
}
if (!OperatorNew) {
// Didn't find a member overload. Look for a global one.
DeclareGlobalNewDelete();
DeclContext *TUDecl = Context.getTranslationUnitDecl();
- if (FindAllocationOverload(StartLoc, Range, NewName, AllocArgs, TUDecl,
- /*AllowMissing=*/false, OperatorNew))
+ if (FindAllocationOverload(StartLoc, Range, NewName, &AllocArgs[0],
+ AllocArgs.size(), TUDecl, /*AllowMissing=*/false,
+ OperatorNew))
return true;
}
@@ -1712,8 +1714,8 @@ bool Sema::FindAllocationFunctions(Sourc
/// FindAllocationOverload - Find an fitting overload for the allocation
/// function in the specified scope.
bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
- DeclarationName Name, MultiExprArg Args,
- DeclContext *Ctx,
+ DeclarationName Name, Expr** Args,
+ unsigned NumArgs, DeclContext *Ctx,
bool AllowMissing, FunctionDecl *&Operator,
bool Diagnose) {
LookupResult R(*this, Name, StartLoc, LookupOrdinaryName);
@@ -1740,13 +1742,15 @@ bool Sema::FindAllocationOverload(Source
if (FunctionTemplateDecl *FnTemplate = dyn_cast<FunctionTemplateDecl>(D)) {
AddTemplateOverloadCandidate(FnTemplate, Alloc.getPair(),
/*ExplicitTemplateArgs=*/0,
- Args, Candidates,
+ llvm::makeArrayRef(Args, NumArgs),
+ Candidates,
/*SuppressUserConversions=*/false);
continue;
}
FunctionDecl *Fn = cast<FunctionDecl>(D);
- AddOverloadCandidate(Fn, Alloc.getPair(), Args, Candidates,
+ AddOverloadCandidate(Fn, Alloc.getPair(),
+ llvm::makeArrayRef(Args, NumArgs), Candidates,
/*SuppressUserConversions=*/false);
}
@@ -1762,7 +1766,7 @@ bool Sema::FindAllocationOverload(Source
// asserted on, though, since invalid decls are left in there.)
// Watch out for variadic allocator function.
unsigned NumArgsInFnDecl = FnDecl->getNumParams();
- for (unsigned i = 0; (i < Args.size() && i < NumArgsInFnDecl); ++i) {
+ for (unsigned i = 0; (i < NumArgs && i < NumArgsInFnDecl); ++i) {
InitializedEntity Entity = InitializedEntity::InitializeParameter(Context,
FnDecl->getParamDecl(i));
@@ -1790,7 +1794,8 @@ bool Sema::FindAllocationOverload(Source
if (Diagnose) {
Diag(StartLoc, diag::err_ovl_no_viable_function_in_call)
<< Name << Range;
- Candidates.NoteCandidates(*this, OCD_AllCandidates, Args);
+ Candidates.NoteCandidates(*this, OCD_AllCandidates,
+ llvm::makeArrayRef(Args, NumArgs));
}
return true;
@@ -1798,7 +1803,8 @@ bool Sema::FindAllocationOverload(Source
if (Diagnose) {
Diag(StartLoc, diag::err_ovl_ambiguous_call)
<< Name << Range;
- Candidates.NoteCandidates(*this, OCD_ViableCandidates, Args);
+ Candidates.NoteCandidates(*this, OCD_ViableCandidates,
+ llvm::makeArrayRef(Args, NumArgs));
}
return true;
@@ -1809,7 +1815,8 @@ bool Sema::FindAllocationOverload(Source
<< Name
<< getDeletedOrUnavailableSuffix(Best->Function)
<< Range;
- Candidates.NoteCandidates(*this, OCD_AllCandidates, Args);
+ Candidates.NoteCandidates(*this, OCD_AllCandidates,
+ llvm::makeArrayRef(Args, NumArgs));
}
return true;
}
@@ -2044,9 +2051,10 @@ bool Sema::FindDeallocationFunction(Sour
DeclContext *TUDecl = Context.getTranslationUnitDecl();
CXXNullPtrLiteralExpr Null(Context.VoidPtrTy, SourceLocation());
- Expr *DeallocArgs[1] = { &Null };
+ Expr* DeallocArgs[1];
+ DeallocArgs[0] = &Null;
if (FindAllocationOverload(StartLoc, SourceRange(), Name,
- DeallocArgs, TUDecl, !Diagnose,
+ DeallocArgs, 1, TUDecl, !Diagnose,
Operator, Diagnose))
return true;
@@ -2236,12 +2244,11 @@ Sema::ActOnCXXDelete(SourceLocation Star
DeclareGlobalNewDelete();
DeclContext *TUDecl = Context.getTranslationUnitDecl();
Expr *Arg = Ex.get();
- Expr *DeallocArgs[1] = { Arg };
if (!Context.hasSameType(Arg->getType(), Context.VoidPtrTy))
Arg = ImplicitCastExpr::Create(Context, Context.VoidPtrTy,
CK_BitCast, Arg, 0, VK_RValue);
if (FindAllocationOverload(StartLoc, SourceRange(), DeleteName,
- DeallocArgs, TUDecl, /*AllowMissing=*/false,
+ &Arg, 1, TUDecl, /*AllowMissing=*/false,
OperatorDelete))
return ExprError();
}
More information about the cfe-commits
mailing list