Closed GoogleCodeExporter closed 9 years ago
This is when you have both -Isomething and -Isomething/B on the command line?
I agree this would be a good feature to add. Do you want to take a shot at a
patch?
Original comment by csilv...@gmail.com
on 9 Apr 2011 at 2:53
Hmm, perhaps I should say a bit more. :-) There are lots of ways to fix this.
Maybe the most principled is to change iwyu_output.cc to deal with filepaths
rather than QuotedIncludes, so we don't have the problem that we think
<A/file_name.h> and <B/A/file_name.h> are different (even though they're both
something/B/A/filename.h).
But I think that would be a lot of work. You'll find it easier, though
kludgier, to do a post-processing step, at the end of
iwyu_output.cc:CalculateDesiredIncludesAndForwardDeclares(), that goes through
'lines', and if if sees two lines that could plausibly come from the same
source file, where one has is_present() but not is_desired(), and the other has
is_desired() but not is_present(), then it deletes the second and sets
is_present() on the first one to true. You'll have to write the code that says
if two quoted-includes could come from the same source file. (I think you'll
want to automatically say no if one quoted include has ""'s and the other has
<>'s.)
Another way to fix it, which is more principled and I like better, is to have a
variant of ConvertToQuotedInclude that takes a list of quoted-includes, and if
possible, picks an entry from the list. That is, while
ConvertToQuotedInclude("something/A/B/foo.h") => \"B/foo.h\"
ConvertToQuotedIncludePreferring("something/A/B/foo.h", vector("\"A/B/foo.h\"")) => \"A/B/foo.h\"
Then inside iwyu_output.cc, we'd use ConvertToQuotedIncludePreferring almost
everywhere, with the list of 'preferred' forward-includes getting updated in
each call to IwyuFileInfo::AddInclude().
Original comment by csilv...@gmail.com
on 9 Apr 2011 at 3:06
Is this fixed by r219 ?
Original comment by saltyho...@gmail.com
on 13 May 2011 at 3:04
I think so. emarin..., can you confirm if it fixes things for you?
Original comment by csilv...@gmail.com
on 15 May 2011 at 9:57
Havne't heard anything in a while. Assuming it is, indeed, fixed. :-) Feel
free to reopen if it's not.
Original comment by csilv...@gmail.com
on 25 Oct 2011 at 12:14
Original issue reported on code.google.com by
emarin...@gmail.com
on 9 Apr 2011 at 12:02