Feed on
Posts
Comments

Archive for May, 2007

Existing Work All of existing work is based on basic C parsers so it can’t be directly applied to C++. I found out that someone did a PhD on refactoring C code resulting in the CRefactory(down atm) project. Looks like reversing the C preprocessor was by far the hardest task to address. Languages consisting of [...]

Undoing CPP – Deep in Enemy Territory

Positive Since the last blog post, I have been investigating on how to teach elsa about the C preprocessor. Overall, I am really happy that MCPP exists and is actively maintained. Preprocessed source code may not be invertible into the original form, but at least it can be undone enough for refactoring purposes. Looks like [...]

CPP Strikes Back

I have gotten used to dodging CPP-expansion issues by fudging column & line information until the position info in squash mostly matches the source positions in the original source code. That sufficed for rewriting declarations, but I have finally hit a brick wall.

Nicely rewriting outparams

Automatic code rewriting business can be a little depressing sometimes. I tend to run into funny issues caused by CPP, oink limitations or just unpleasant-to-rewrite parts of C++. After banging my head against the wall due to all these issues I finally arrived at a workable approach for the easy part of the outparam rewrite.

Squash Outparams The following took me a few days to achieve. ./squash -sq-rewrite-outparams out2.txt -sq-implementation nsBidiPresUtils -sq-no-squash -o-lang GNU_Cplusplus ~/work/ff-build/dom/src/base/nsFocusController.i where out2.txt contains instructions on which functions to modify nsFocusController::GetFocusedElement,0=mCurrentElement, produces — /Users/tarasglek/work/mozilla/dom/src/base/nsFocusController.h +++ /Users/tarasglek/work/mozilla/dom/src/base/nsFocusController.h @@ -72,1 +72,1 @@ – NS_IMETHOD GetFocusedElement(nsIDOMElement** aResult); + nsIDOMElement* GetFocusedElement(); This still doesn’t add the already_AddRefed or other important [...]

Automated Analyses and Rewrites Dehydra and Squash are now mature enough to assist with mundane tasks like renames and various kinds of tedious code inspection. If you ever suspect that part of the Mozilla hacking you are doing could be done by a tool, contact me to see if I have a suitable tool for [...]