r174943 - Fix a bug reduced from a crash when trying to use modules with libc++. We check

Richard Smith richard at metafoo.co.uk
Fri Feb 22 14:49:49 PST 2013


On Fri, Feb 22, 2013 at 11:19 AM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> >  Linkage NamedDecl::getLinkage() const {
> > -  if (HasCachedLinkage) {
> > -    assert(Linkage(CachedLinkage) ==
> > -           getLVForDecl(this, true).linkage());
> > +  if (HasCachedLinkage)
> >      return Linkage(CachedLinkage);
> > -  }
>
> This was one of my favorites asserts :-(
>
> Would the attached patch be OK?


We can't call getCachedLinkage on both functions in isSameEntity. We only
know one of them has cached linkage, not both.

IMO, the right way to fix this is to get rid of the linkage cache, and
compute and store linkage when an entity is first declared. We only need
caching and recomputation for visibility.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130222/70d8c4e0/attachment.html>


More information about the cfe-commits mailing list