weixin_39822993 2020-11-30 11:25
浏览 0

iwyu does not detect a necessary include: Covariant return type not detected

Originally reported on Google Code with ID 62


When using iwyu on code with a overloaded virtual function that has a return type different
from the function in the base class, iwyu is satisfied with a forward declaration even
though the compiler seems to need a full definition. I have attached a test for this.

I can work on this; I will, however, need to familiarize myself with the clang AST
first. My current guess is that IwyuBaseAstVisitor::VisitFunctionDecl should be the
right place for the change or is there a more appropriate place?

Reported by lars.schewe.private on 2011-10-27 11:47:01

该提问来源于开源项目:include-what-you-use/include-what-you-use

  • 写回答

13条回答 默认 最新

  • weixin_39822993 2020-11-30 11:25
    关注
    
    I'm not sure I understand the problem -- what type is it satisfied with the forward
    declaration of?  It would be helpful if you could include the output of the iwyu run.
    
    I can believe there's a bug here -- iwyu has lots of bugs around corner cases in the
    language around when a full type is needed and when it's not.  Honestly, I feel trying
    to get them all right is like playing whac-a-mole.  I'd like to rework iwyu (and clang)
    to have clang tell iwyu when it needs a full type for some reason, rather than tryint
    to rederive the information.  That should fix problems like this 'for free'.
    
    That said, it's a major undertaking, and it's probably going to be quite a while before
    it's ready -- at least half a year.  So trying to make things better in the meantime
    is sensible if it's something you'd like to do!  But first step is to figure out what's
    going wrong.  We won't know what fix to make until we know what error iwyu is making.
     You'll probably want to play around with --v=6 output (yes, it's quite messy).
    

    Reported by csilvers on 2011-10-27 23:47:24

    评论

报告相同问题?