[cfe-commits] Fix crash with lambda argument to a template function

Rafael EspĂ­ndola rafael.espindola at gmail.com
Fri Jan 11 18:28:18 PST 2013


Given the testcase in llvm.org/pr14929 I think we will need something
different. Putting this patch on hold for now.

On 11 January 2013 15:13, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> Sending this again because I think it got lost in an unrelated thread.
>
> The attached patch fixes a crash in the included testcase. It does so
> by not trying to compute the LV at a time where me might still not
> know it. The problematic sequence right now is:
>
> * We try to find out if f's LV.
> * For that we try to find the LV of the argument type.
> * For that we try to find the LV of the lambda.
> * For that we try to find the LV of the context (which is g).
> * hasBody returns false for g, which causes us to get the wrong answer
> because of -fvisibility-inlines-hidden.
>
> A downside is that more decls get added to UndefinedInternals only to
> be filtered out at the end of the translation unit.
>
> A possible optimization on top of this patch is to add a
> hasCachedLinkage method to NamedDecl. If we already know the linkage,
> it is safe to use it.
>
> A completely different option is to set a dummy (pointer cast of 1 for
> example) body in g's decl while we construct the real one.
>
> Cheers,
> Rafael1




More information about the cfe-commits mailing list