<p dir="ltr">It's not that; the ASTReader doesn't register these hooks.</p>
<p dir="ltr">I've hit something that looks exactly like PR19061 modularizing LLVM. I have a hack around it, but not a proper fix yet.</p>
<div class="gmail_quote">On 12 May 2014 22:36, "Jordan Rose" <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I wonder if this is <a href="http://llvm.org/bugs/show_bug.cgi?id=19061" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=19061</a>. (I don't have a clean tree to rebuild/test with right now.)<br>
<br>
Jordan<br>
<br>
<br>
On May 12, 2014, at 17:34 , Richard Smith <<a href="mailto:richard-llvm@metafoo.co.uk">richard-llvm@metafoo.co.uk</a>> wrote:<br>
<br>
> Author: rsmith<br>
> Date: Mon May 12 19:34:43 2014<br>
> New Revision: 208659<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=208659&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=208659&view=rev</a><br>
> Log:<br>
> Refactor and fix a latent bug (found by inspection) where an external AST<br>
> source that provides a declaration from a hidden module would not have the<br>
> visibility of the produced definition checked. This might matter if an<br>
> external source chose to import a new module to provide an extra definition,<br>
> but is not observable with our current external sources.<br>
><br>
> Modified:<br>
> cfe/trunk/lib/Sema/SemaType.cpp<br>
><br>
> Modified: cfe/trunk/lib/Sema/SemaType.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=208659&r1=208658&r2=208659&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=208659&r1=208658&r2=208659&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Sema/SemaType.cpp (original)<br>
> +++ cfe/trunk/lib/Sema/SemaType.cpp Mon May 12 19:34:43 2014<br>
> @@ -5214,39 +5214,36 @@ bool Sema::RequireCompleteTypeImpl(Sourc<br>
> return false;<br>
> }<br>
><br>
> - // FIXME: If there's an unimported definition of this type in a module (for<br>
> + const TagType *Tag = T->getAs<TagType>();<br>
> + const ObjCInterfaceType *IFace = T->getAs<ObjCInterfaceType>();<br>
> +<br>
> + // If there's an unimported definition of this type in a module (for<br>
> // instance, because we forward declared it, then imported the definition),<br>
> // import that definition now.<br>
> + //<br>
> // FIXME: What about other cases where an import extends a redeclaration<br>
> // chain for a declaration that can be accessed through a mechanism other<br>
> // than name lookup (eg, referenced in a template, or a variable whose type<br>
> // could be completed by the module)?<br>
> + if (Tag || IFace) {<br>
> + NamedDecl *D =<br>
> + Tag ? static_cast<NamedDecl *>(Tag->getDecl()) : IFace->getDecl();<br>
><br>
> - const TagType *Tag = T->getAs<TagType>();<br>
> - const ObjCInterfaceType *IFace = 0;<br>
> -<br>
> - if (Tag) {<br>
> - // Avoid diagnosing invalid decls as incomplete.<br>
> - if (Tag->getDecl()->isInvalidDecl())<br>
> - return true;<br>
> -<br>
> - // Give the external AST source a chance to complete the type.<br>
> - if (Tag->getDecl()->hasExternalLexicalStorage()) {<br>
> - Context.getExternalSource()->CompleteType(Tag->getDecl());<br>
> - if (!Tag->isIncompleteType())<br>
> - return false;<br>
> - }<br>
> - }<br>
> - else if ((IFace = T->getAs<ObjCInterfaceType>())) {<br>
> // Avoid diagnosing invalid decls as incomplete.<br>
> - if (IFace->getDecl()->isInvalidDecl())<br>
> + if (D->isInvalidDecl())<br>
> return true;<br>
><br>
> // Give the external AST source a chance to complete the type.<br>
> - if (IFace->getDecl()->hasExternalLexicalStorage()) {<br>
> - Context.getExternalSource()->CompleteType(IFace->getDecl());<br>
> - if (!IFace->isIncompleteType())<br>
> - return false;<br>
> + if (auto *Source = Context.getExternalSource()) {<br>
> + if (Tag)<br>
> + Source->CompleteType(Tag->getDecl());<br>
> + else<br>
> + Source->CompleteType(IFace->getDecl());<br>
> +<br>
> + // If the external source completed the type, go through the motions<br>
> + // again to ensure we're allowed to use the completed type.<br>
> + if (!T->isIncompleteType())<br>
> + return RequireCompleteTypeImpl(Loc, T, Diagnoser);<br>
> }<br>
> }<br>
><br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br>
</blockquote></div>