Index: clang/lib/Sema/SemaOverload.cpp =================================================================== --- clang/lib/Sema/SemaOverload.cpp +++ clang/lib/Sema/SemaOverload.cpp @@ -10425,6 +10425,25 @@ // We don't really have anything else to say about viable candidates. S.NoteOverloadCandidate(Cand->FoundDecl, Fn); + + // If this is a builtin function, give the available definitions. + if (S.getLangOpts().OpenCL && Fn->isImplicit()) { + raw_ostream &OS = llvm::outs(); + unsigned NumParams = Fn->getNumParams(); + + OS << Fn->getReturnType().getAsString() << " "; + OS << Fn->getNameInfo().getAsString() << "("; + + if (NumParams > 0) { + OS << Fn->getParamDecl(0)->getOriginalType().getAsString(); + } + for (unsigned i = 1; i < NumParams; i++) { + OS << ", "; + OS << Fn->getParamDecl(i)->getOriginalType().getAsString(); + } + OS << ")\n"; + } + return; }