Skip to content

Refactoring

After checking out the high level libraries (http://clang.llvm.org/docs/LibTooling.html) I believe our libclangmm is quite much better to achieve fast and accurate refactoring (for instance rename across files). The high level libraries (LibTooling) feels like Java subclass madness with template programming on top. Really bad choices of the libclang people in my opinion, and I'll leave out the compiling problems! libclangmm is also much faster, since we can reuse the translationunits, and clang-rename, for instance, was very buggy (did not work correctly on one file even, and with two files it went crazy). clang-rename did also NOT parse the files in parallel...

However, refactoring is almost ready in the lastest libclangmm, at least renaming for instance. But to use it we have to open all the files that are using/declaring/initiate the variables/methods/classes/etc and parse them (in parallell) if they are not open yet and has a ready translationunit. I guess the easiest solution is to open all the files needed in tabs (after figuring out how to find all the files that includes a specific header file, direct or indirect), if they are not yet open, be sure all the needed tabs are parsed and saved, and finally apply the refactoring (without saving). Or we could do this in the background with maybe a dialog asking the user to apply the refactoring on the shown files, and save them. Or maybe you guys have a better idea how this could work?

Also, given a header file, have you seen a way to find all the cpp/header-files including the given header file? That is direct or indirect through other includes?

Feel free to label this, I didn't figure out how to do that.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information