doctaweeks / include-what-you-use

Automatically exported from code.google.com/p/include-what-you-use
Other
0 stars 0 forks source link

iwyu suggests use of the internal header file auto_ptr.h #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This code:

  #include <memory>
  void foo()
  {
    std::auto_ptr<int> i;
  }

gives the following output from iwyu:

foo.cpp should add these lines:
#include <auto_ptr.h>                   // for auto_ptr

foo.cpp should remove these lines:
- #include <memory>  // lines 1-1

The full include-list for foo.cpp:
#include <auto_ptr.h>                   // for auto_ptr

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

Including memory is ok. auto_ptr.h is an internal libstdc++ header file and 
should not be included directly.

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

clang version 3.1 (trunk 143346)
Target: x86_64-unknown-linux-gnu

Original issue reported on code.google.com by jonas.bu...@gmail.com on 1 Nov 2011 at 2:34

GoogleCodeExporter commented 9 years ago
This should be easy to fix by adding an entry to iwyu_include_picker.cc mapping 
auto_ptr.h to memory.  Would you like to give it a shot and attach a diff here?

Original comment by csilv...@gmail.com on 2 Nov 2011 at 12:53

GoogleCodeExporter commented 9 years ago
Thanks for the hint. The patch is attached.

> ~/local/bin/include-what-you-use -c foo.cpp

(foo.cpp has correct #includes/fwd-decls)

Original comment by jonas.bu...@gmail.com on 2 Nov 2011 at 8:58

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks!  Should make it into svn trunk tomorrow.

Original comment by csilv...@gmail.com on 2 Nov 2011 at 11:58

GoogleCodeExporter commented 9 years ago
I know this has been applied, so this defect can be closed. The OP is a 
colleague of mine, and I can maybe persuade him to confirm that this specific 
issue is fixed, if necessary.

Original comment by kim.gras...@gmail.com on 16 Sep 2012 at 4:04

GoogleCodeExporter commented 9 years ago

Original comment by vsap...@gmail.com on 30 Dec 2012 at 8:31