[cfe-dev] Should we build semantically invalid nodes?
Argiris Kirtzidis
akyrtzi at gmail.com
Sun Oct 26 12:27:45 PDT 2008
Chris Lattner wrote:
>
>
> On top of that, refactoring isn't just about renaming things... it has
> to do a lot of verification to make sure that the transformation is
> safe. For example, in:
>
>
> int G;
> int foo(int H) {
> return G+H;
> }
>
> A refactoring tool is supposed to not allow you to rename G to H
> because it would be shadowed (and thus change semantics) in foo.
This is orthogonal to finding all the references. If you want to
disallow shadowing, whether you have
int G;
int foo(int H) {
return G+H;
}
or
int G;
int foo(int H) {
return reinterpret_cast<char>(G)+H;
}
you still have to check shadowing.
An interesting sidenote is that the Eclipse Java refactoring works on
semantically invalid code (code that won't compile) and also warns for
the shadowing thing (just checked).
-Argiris
More information about the cfe-dev
mailing list