In the following example, we have a declaration of weakfoo before #pragma weak.
extern void weakfoo();
void localfoo() { }
#pragma weak weakfoo=localfooThere are two decls for weakfoo, this leads to assertion failure later (during search a decl for a call to weakfoo):
lib/Sema/SemaOverload.cpp:5583: 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.
I suggest to call CheckFunctionDeclaration so that 2 decls for the weakfoo are merged.