Fwd: [modules] PR24954

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 8 06:59:46 PDT 2015


Forwarding to cfe-commits


-------- Forwarded Message --------
Subject: 	[modules] PR24954
Date: 	Thu, 8 Oct 2015 15:53:55 +0200
From: 	Vassil Vassilev <vvasilev at cern.ch>
To: 	Richard Smith <richard at metafoo.co.uk>, cfe-dev at cs.uiuc.edu 
<cfe-dev at cs.uiuc.edu>
CC: 	Ben Langmuir <blangmuir at apple.com>



Hi Richard,
   I started working on https://llvm.org/bugs/show_bug.cgi?id=24954

   IIUC r228485 introduces an abstraction to deal with
not-really-anonymous friend decls
(serialization::needsAnonymousDeclarationNumber in ASTCommon.cpp).

   A comment explicitly says:
   "// This doesn't apply to friend tag decls; Sema makes those
available to name
    // lookup in the surrounding context."

   In the bug reproducer, the friend function (wrt __iom_t10) is forward
declared in the same namespace, where Sema makes the friend available
for a name lookup.

   It seems that the friend operator<< in __iom_t10 (sorry about the
names they come from libcxx) doesn't get registered in the ASTWriter's
DeclIDs but it gets registered in outer namespace's lookup table. Thus,
assert is triggered when finalizing module A, since it rebuilds the
lookups of the updated contexts.

   The issue only appears when building module A deserializes/uses module B.

   Currently I was assume that something wrong happens in either
needsAnonymousDeclarationNumber or I hit a predicted issue
ASTWriterDecl.cpp:1602
     // FIXME: This is not correct; when we reach an imported declaration we
     // won't emit its previous declaration.
     (void)Writer.GetDeclRef(D->getPreviousDecl());
     (void)Writer.GetDeclRef(MostRecent);

   The issue seems a fairly complex one and I am a bit stuck.

   Any hints are very very welcome ;)
Many thanks,
Vassil





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151008/abfaf65b/attachment-0001.html>


More information about the cfe-commits mailing list