Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Issue 1505823003: Add script to mass add a new #include.

Created:
5 years ago by dcheng
Modified:
4 years, 8 months ago
Reviewers:
danakj, Nico
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add script to mass add a new #include. Useful for things like scoped_ptr<T> => std::unique_ptr<T>. Usage: python add_header.py --header "<memory>" a/b.cc c/d.cc ... BUG=557422

Patch Set 1 #

Patch Set 2 : Minor bug fix #

Patch Set 3 : Anchor the end of the regexes #

Patch Set 4 : Fuzzy path matching #

Patch Set 5 : Update to latest Google style example. #

Patch Set 6 : Cheddar monkey #

Patch Set 7 : Some fixes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+794 lines, -0 lines) Patch
A cheddar_monkey.py View 1 2 3 4 5 6 1 chunk +59 lines, -0 lines 0 comments Download
A tools/clang/pass_to_move/add_header.py View 1 2 3 4 5 6 1 chunk +318 lines, -0 lines 0 comments Download
A tools/clang/pass_to_move/add_header_test.py View 1 2 3 4 1 chunk +417 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 7 (2 generated)
dcheng
I wrote this... and then found sort-headers.py. There's some overlap (but my version is tested!): ...
5 years ago (2015-12-07 19:28:54 UTC) #3
Nico
On 2015/12/07 19:28:54, dcheng wrote: > I wrote this... and then found sort-headers.py. There's some ...
5 years ago (2015-12-07 19:31:56 UTC) #4
danakj
On Mon, Dec 7, 2015 at 11:31 AM, <thakis@chromium.org> wrote: > On 2015/12/07 19:28:54, dcheng ...
5 years ago (2015-12-07 19:33:18 UTC) #5
dcheng
I think it would be easier to express sort-headers in terms of this module, since ...
5 years ago (2015-12-07 19:56:30 UTC) #6
Nico
5 years ago (2015-12-07 19:57:01 UTC) #7
That's fine too; in any case we shouldn't have to very similar scripts
checked in

On Mon, Dec 7, 2015 at 2:56 PM, Daniel Cheng <dcheng@chromium.org> wrote:

> I think it would be easier to express sort-headers in terms of this
> module, since this script breaks it down into more composable parts.
>
> On Mon, Dec 7, 2015, 11:33 Dana Jansens <danakj@chromium.org> wrote:
>
>> On Mon, Dec 7, 2015 at 11:31 AM, <thakis@chromium.org> wrote:
>>
>>> On 2015/12/07 19:28:54, dcheng wrote:
>>>
>>>> I wrote this... and then found sort-headers.py. There's some overlap
>>>> (but my
>>>> version is tested!):
>>>>
>>>
>>> Things that it looks like I need to better handle:
>>>> - Forcing <windows.h> to be first, and other fun implicit dependencies.
>>>> - "config.h" in Blink (though the tool as is won't work on Blink
>>>> anyway, since
>>>> Blink doesn't use full paths)
>>>> - Apparently you can have bare import with out the #?
>>>>
>>>
>>> that's clang's module extension
>>> (http://llvm.org/devmtg/2012-11/Gregor-Modules.pdf for import vs
>>> #import etc).
>>> We hopefully don't use that anywhere.
>>>
>>> clang-format will have header sorting after the next roll unless we
>>> disable
>>> this. It probably also gets much of this wrong.
>>>
>>> Could this tool use sort_headers in some form to become simpler?
>>
>>
>> That would implicitly test sort_headers too... :)
>>
>>
>>>
>>>
>>>
>>> On the other hand, this tool handles:
>>>> - Sorting the primary header first (this might be handled in
>>>> sort-headers.py
>>>>
>>> but
>>>
>>>> I can't really tell where)
>>>> - Preamble comments (this can be easily extended to #define, #undef,
>>>> etc which
>>>> may be useful for some crazy X11 stuff):
>>>>    // moo
>>>>    #include "cow.h"
>>>> - Add newlines to separate primary from system from user headers.
>>>>
>>>
>>>
>>> https://codereview.chromium.org/1505823003/
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups
"Chromium-reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698