This change fixes assertion failure in this example:
extern void f();
void g() { }
#pragma weak f = g
extern void externmain() { return f(); }
(clang-3.9: /export/users/amusman/opensource/ctrunka/llvm/tools/clang/lib/Sema/SemaOverload.cpp:5697: void clang::Sema::AddOverloadCandidate(clang::FunctionDecl*, clang::DeclAccessPair, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, bool): Assertion `Proto && "Functions without a prototype cannot be overloaded"' failed.)
It seems to also fix the error message on the following example (from bug 15695):
extern int PFoo(int);
#pragma weak PFoo = Foo
int Foo(int a) { return a; }
int main() {
return PFoo(1);
}
It turns out my previous change (http://reviews.llvm.org/D13048) broke pragma weak in some cases, this is updated patch for this issue.
You should be doing redeclaration lookup here.