The way both the REPL and the --top-level mode of the expression parser work is that they compile and JIT the code the user provided, and then look through the resultant IR and find any llvm::Functions produced by the compilation. Then it iterates over those functions and if they are marked "external", it adds them to a table of functions that it then makes available to subsequent expressions.
The test we were using for "is external" was hasExternalLinkage || hasLinkOnceODRLinkage. However, there's a third form of external function: hasWeakODRLinkage that can sometimes be produced, which is also intended to be an exported symbol. This patch just includes that predicate to the test we were doing.
I don't have a way to write a C-based test for this as I don't know how to craft a user expression in C that will make such a thing. I asked around a bit and nobody had an easy way to do this.
OTOH, the swift compiler uses this linkage type when it makes the "default argument provider" for a function with default arguments. So I can easily write a swift REPL test for this. But if somebody knows how to make a C function in the lldb expression parser with a WeakODRLinkage, show me and I'll happily add a test for it here.