[cfe-dev] Tooling: how to deal with headers?

Sean Silva silvas at purdue.edu
Sun Jan 13 12:25:08 PST 2013


Hi Tooling folks, I have a quick question about making changes to
headers with a clang tool.

Suppose the following basic setup:

- I have a compile_commands.json for a project.
- I have a tool that renames class Foo to Bar.

So if Foo appears in headers, how do occurrences of Foo in headers get renamed?

To my understanding, the compile_commands.json only tracks the ".cpp"
files that are compiled, rather than each source file in the project.
This makes me wonder:

- How will a tool will ensure that Foo only gets renamed once if it is
in a header that is included multiple times?

- Once Foo gets renamed in a header, how will the other files that
have yet to be processed still see the old name (the new name would
cause a compilation failure since the references in the other ".cpp"
file will not have yet been renamed).

Is there a "standard" way to deal with this?

-- Sean Silva



More information about the cfe-dev mailing list