Re-add IsOverload() and FuncArgTypesMatch() we need them after all.

See b706579ac554e3e5f6e6cc031a21b40f158f1f82
This commit is contained in:
Philippe Canal 2013-08-12 12:32:16 -05:00 committed by sftnight
parent 59db7bbeea
commit d53e192286

View File

@ -398,6 +398,40 @@ namespace cling {
return foundDC;
}
static bool FuncArgTypesMatch(const ASTContext& C,
const llvm::SmallVector<QualType, 4>& GivenArgTypes,
const FunctionProtoType* FPT) {
// FIXME: What if FTP->arg_size() != GivenArgTypes.size()?
FunctionProtoType::arg_type_iterator ATI = FPT->arg_type_begin();
FunctionProtoType::arg_type_iterator E = FPT->arg_type_end();
llvm::SmallVector<QualType, 4>::const_iterator GAI = GivenArgTypes.begin();
for (; ATI && (ATI != E); ++ATI, ++GAI) {
if (!C.hasSameType(*ATI, *GAI)) {
return false;
}
}
return true;
}
static bool IsOverload(const ASTContext& C,
const TemplateArgumentListInfo* FuncTemplateArgs,
const llvm::SmallVector<QualType, 4>& GivenArgTypes,
FunctionDecl* FD, bool UseUsingDeclRules) {
//FunctionTemplateDecl* FTD = FD->getDescribedFunctionTemplate();
QualType FQT = C.getCanonicalType(FD->getType());
if (llvm::isa<FunctionNoProtoType>(FQT.getTypePtr())) {
// A K&R-style function (no prototype), is considered to match the args.
return false;
}
const FunctionProtoType* FPT = llvm::cast<FunctionProtoType>(FQT);
if ((GivenArgTypes.size() != FPT->getNumArgs()) ||
//(GivenArgsAreEllipsis != FPT->isVariadic()) ||
!FuncArgTypesMatch(C, GivenArgTypes, FPT)) {
return true;
}
return false;
}
static
const FunctionDecl* overloadFunctionSelector(DeclContext* foundDC,
bool objectIsConst,