[Lldb-commits] [PATCH] D78972: Treat hasWeakODRLinkage symbols as external in REPL computations

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 28 10:11:44 PDT 2020

jingham added a comment.

In D78972#2007493 <https://reviews.llvm.org/D78972#2007493>, @labath wrote:

> > 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.
> Grepping clang's tests for `weak_odr` was very educational. The most portable way to produce this linkage seems to be:
>   template<typename T> void f() {}
>   template void f<int>();
> As for whether this patch is correct -- I don't know. The weak_odr functions are allowed to be replaced (that's the `weak` part), but the replacement is supposed to be equivalent (the `odr` part). So, strictly speaking, it may be ok to just export this function, but if we wanted to be closer to what happens for realz, we should check first if there isn't a more definitive version available elsewhere...

I can't get the expression parser to successfully run this code and then call the function in a later evaluation.  Apparently we're not all the way up to creating & instantiating templates.  I tried it with and without this patch and it didn't make any difference.

In the context of the REPL & top-level, I'm not sure how we would find the "equivalent version".  But if it is supposed to be equivalent, is that important for functions the REPL & top-level are generating?

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list