tooling refactoring method and function specifiers


I have a relatively large code base and I want to refactor it to add
everywhere the CUDA specifiers __host__ __device__, of course hidden in
some macro. Has anyone wrote a tool for this or did something similar?
It could also be used to add the declspec specifier to build dll for
windows. Any hints?

Thank you,