News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

small bug in Rename symbols command

Started by frithjofh, May 11, 2011, 10:59:38 AM

Previous topic - Next topic

frithjofh

Hello everybody,

I think there is a small bug in the "Rename symbol" command. If the name of a class (or any other symbol, but that is a little less likely) is the same as the name of the header file, than the include directives of that header file get changed when you use the command to change the class name. I did the test with a class name I wanted to change to begin with a capital letter and the execution of the command changed the file name in the include directives accordingly. Reproducible and always.

Another related bug which I can't reproduce always (it seems to happen intermittently) is that when changing the class name to begin with a capital letter it gets changed alright, but the change is not done in the second mentioning of the class in it's constructors. The original code:

surface::surface() {}

gets changed to

Surface::surface() {}

Regards and greetings from Asturias

frithjofh
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

ollydbg

#1
thanks for the bug report!!!

first issue:
Quote
I think there is a small bug in the "Rename symbol" command. If the name of a class (or any other symbol, but that is a little less likely) is the same as the name of the header file, than the include directives of that header file get changed when you use the command to change the class name. I did the test with a class name I wanted to change to begin with a capital letter and the execution of the command changed the file name in the include directives accordingly. Reproducible and always.
Ok, from the internal algorithm I know, I think it is definitely a bug. For example:

#include "Apple.h"
#include <Apple.h>
class Apple
{
};
Apple a;

Rename "Apple" to "Orange" will change four occurrences in the code snippet.
This can be simply filter out a preprocessor line. Note "Rename" feature is not 100% correct unless we do a full parsing and walk on the AST (like a compiler did). Currently implementation is very limited.

Issue 2:
Maybe we can add a special case of handling constructors renaming. I don't know much about the reason. :D, hope i will get some time to look into it.

PS:
My current interest was doing a quex based parser, see:
http://code.google.com/p/quexparser/
and
http://code.google.com/p/quexparser/source/browse/trunk/parser.cbp
:)




If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.