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

#include <ostream> vs #include "ostream"

Originally reported on Google Code with ID 60


What steps will reproduce the problem?  Give the *exact* arguments passed
to include-what-you-use, and attach the input source file that gives the
problem (minimal test-cases are much appreciated!)
1. Use iwyu on a file missing some system includes
2. Compiling using cmake (cf #26), but issue is not related

What is the expected output? What do you see instead?

This is what I get:

#include <stdlib.h>                     // for atoi, atof, EXIT_SUCCESS
#include <string>                       // for operator==
#include "new"                          // for operator delete[], etc
#include "ostream"                      // for operator<<

I'd like to get:

#include <stdlib.h>                     // for atoi, atof, EXIT_SUCCESS
#include <string>                       // for operator==
#include <new>                          // for operator delete[], etc
#include <ostream>                      // for operator<<

What version of the product are you using? On what operating system?

iwyu revision: 304
gcc 4.6.1 on a Linux Debian testing.

Please provide any additional information below.

I suspect it's related to some missing case in iwyu_include_picker.cc
I will come with a minimal test case if necessary.

</ostream></new></string></stdlib.h></string></stdlib.h>

Reported by emmanuel.christophe on 2011-09-23 05:49:35

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

  • 写回答

19条回答 默认 最新

  • weixin_39822993 2020-11-30 11:25
    关注
    
    My guess is it is an issue with cmake actually, though it's hard to tell with the data
    given.  It's unlikely to be iwyu_include_picker.cc.
    
    Assuming ostream is a newly added include, iwyu decides whether to use <> or "" based
    on whether the file is in a 'system' directory.  It gets the list of system directories
    from clang.  If you provide the full output of the iwyu run, it should say where ostream
    lives.  Then you'll need to figure out what arguments cmake provides to iwyu (if any)
    to see what the system directories are.  Otherwise it will be the default system directories,
    which you can easily find by running iwyu in the debugger, though it may be possible
    some other way, via clang tools.
    
    If you can't figure it out, the most useful info for you to include would be the *full*
    output of the iwyu run, and the exact command you used to run iwyu.  A minimal test
    case, as you suspect, would also be helpful, but not as helpful as the first two.
    

    Reported by csilvers on 2011-09-23 14:43:20

    评论

报告相同问题?