gbjie / include-what-you-use

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

fix_includes c++ file pattern #143

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
fix_includes only uses cc as file extension and not also cpp when computing 
canonical_file. Attached patch is a simple solution. Proper fix might combine 
this somehow with _SOURCE_EXTENSIONS.

Original issue reported on code.google.com by rol...@rschulz.eu on 31 May 2014 at 11:27

GoogleCodeExporter commented 9 years ago

Original comment by rol...@rschulz.eu on 31 May 2014 at 11:27

Attachments:

GoogleCodeExporter commented 9 years ago
Two patches this time.

It turns out fix_includes_test.py fails on Windows, so I fixed some assumptions 
around path separators (143-prep.patch.)

With that in place, 143-fix.patch should fix the problem (using 
_SOURCE_EXTENSIONS) and passes all the tests.

Roland, could you give it a try and see if it solves your local problem?

Original comment by kim.gras...@gmail.com on 1 Jun 2014 at 7:53

Attachments:

GoogleCodeExporter commented 9 years ago
yes this fixes it

Original comment by rol...@rschulz.eu on 2 Jun 2014 at 3:43

GoogleCodeExporter commented 9 years ago
What if instead one complex `pattern` we remove at first extension, then 
(_unittest|_regtest|_test)?  It doesn't preserve current behavior, but it 
corresponds to GetCanonicalName in iwyu_path_util.cc.  And I think we need to 
update _IsMainCUInclude doc string and comment before "canonical_include = 
re.sub(r'(-inl\.h|\.h)$'," string.

143-prep.patch is good as is.

Original comment by vsap...@gmail.com on 2 Jun 2014 at 7:30

GoogleCodeExporter commented 9 years ago
Prep patch went into r551.

Sounds good, see attached revision. It passes the tests so I'm hoping it's 
good, but could you double-check with this one, roland?

Original comment by kim.gras...@gmail.com on 3 Jun 2014 at 6:42

Attachments:

GoogleCodeExporter commented 9 years ago
Looks good to me.

Original comment by vsap...@gmail.com on 3 Jun 2014 at 9:26

GoogleCodeExporter commented 9 years ago
Thanks, r553.

Oops, I forgot to wait for roland's input... Could you svn up and see that this 
variation solves your problem also? Thanks!

Original comment by kim.gras...@gmail.com on 4 Jun 2014 at 4:18

GoogleCodeExporter commented 9 years ago
Yes this is fixed. Thanks.

Original comment by rol...@rschulz.eu on 5 Jun 2014 at 4:39

GoogleCodeExporter commented 9 years ago
Lovely, thanks!

Original comment by kim.gras...@gmail.com on 5 Jun 2014 at 8:36