LukasScheucher / include-what-you-use

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

Forward declaration of class in a namespace not recognized as legit #25

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
/path/to/include-what-you-use animation_container.cc -I.

animation_container.h should add these lines:
#include "animation_container_element.h"  // for AnimationContainerElement

animation_container.h should remove these lines:
- namespace ui { class AnimationContainerElement; }  // lines 7-7

The full include-list for animation_container.h:
#include <set>                          // for set
#include "animation_container_element.h"  // for AnimationContainerElement

---

animation_container.cc should add these lines:

animation_container.cc should remove these lines:
- #include "animation_container_element.h"  // lines 3-3

The full include-list for animation_container.cc:
#include "animation_container.h"

---

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

I expect that the forward declaration of AnimationContainerElement would be 
considered legit and that iwyu would not state I should remove the forward 
declaration.

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

Clang 3.0 (trunk 127569)
iwyu r96

Original issue reported on code.google.com by jhawk...@chromium.org on 29 Mar 2011 at 12:13

Attachments:

GoogleCodeExporter commented 8 years ago
My guess is that this is a typedef issue.  iwyu puts pretty strong requirements 
about what you need to #include when you create a typedef (since you're 
basically saying you're "re-exporting" the typedef).

If you wanted to confirm this, you could try running with --verbose=6 to see 
what it has to say about why it wants the complete type here.

I plan on revisiting my handling of typedefs shortly.  I'm hoping that will 
address this problem.

Original comment by csilv...@gmail.com on 29 Mar 2011 at 12:24

GoogleCodeExporter commented 8 years ago
Interesting. I'm running the include-what-you-use binary directly on 
animation_container.cc; when I pass in --verbose=6, I get the following error:

error: unsupported option '--verbose=6'

Original comment by jhawk...@chromium.org on 29 Mar 2011 at 12:27

GoogleCodeExporter commented 8 years ago
Sorry, I don't think commandlineflags are well documented yet.  The flags are
   -Xiwyu --verbose=6

Original comment by csilv...@gmail.com on 29 Mar 2011 at 12:34

GoogleCodeExporter commented 8 years ago
I'm not 100% positive, but am 98% positive this is the same as issue 27.

Original comment by csilv...@gmail.com on 31 Mar 2011 at 5:55