Review Request 124256: Introduce rename field refactoring
Maciej Poleski
d82ks8djf82msd83hf8sc02lqb5gh5 at gmail.com
Mon Jul 6 22:46:26 UTC 2015
> On Lip 6, 2015, 7:47 po południu, Aleix Pol Gonzalez wrote:
> > What about getting some unit testing? Sounds like an important piece of code...
Its open problem. To make real-world test (more than one TU) we need compilation database. It means that we have to create real files (or write even more code to create reasonable FixedCompilationDatabase).
Even then we have to think about test of this code and not AST building code or AST matching code (which is implemented in Clang). The problem I currently have is that I can easily support all code bases I can imagine (but only correct), but I can't guarantee that these imaginations are "complete" (that I predicted everything). The problem is to check if really everything is supported, not the features I predicted (because everything is done by Clang and I assume there is no reason to test its correctness). The only thing which requires testing is my analysis. Take look at this:
```
void f()
{
int x = 5;
x *= 2;
}
```
Rename `x` to `asdf`. Nice test. The problem is that after picking apropriate method, rest of task is done by Clang. What is worse - making setup of this test would be far more complicated than _my_ code executed during refactoring.
Generaly in refactorings from this family my problem is to decide which symbols should be renamed. When I make such decision Clang can bring to me all information I need. It also gives me tool which I can use to say: "replace this *x* by that *y*". The only problem is to decide. How to check if my decisions are correct?
In above example `x` is variable without linkage - I _assume_ this variable occurs only in _this_ translation unit and thus compare all *DeclRefExpr* declarations canonical declaration with canonical declaration of `x` (compare address of AST node, the same with *VarDecl*s). Getting canonical declaration is trivial - just call apropriate method.
What should be tested is if my reasonig is complete.
- Maciej
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/124256/#review82143
-----------------------------------------------------------
On Lip 5, 2015, 4:56 po południu, Maciej Poleski wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/124256/
> -----------------------------------------------------------
>
> (Updated Lip 5, 2015, 4:56 po południu)
>
>
> Review request for KDevelop.
>
>
> Repository: kdev-clang
>
>
> Description
> -------
>
> Renaming of fields with external linkage.
>
> Renaming of fields from classes in anonymous namespaces is also done
>
>
> Diffs
> -----
>
> clangsupport.cpp e22c55426a2e839ec11cbe0b2fe1e13721b0583a
> clangsupport.h 8ed1ec90bbbc41d7c7a94d926e0951c729a6194c
> CMakeLists.txt 875172a8407f4bd9faf330f032a280fa66c2b16f
> cmake/FindClang.cmake 6c9bd6ef0242319122dcc7e6fd6cea8d9f0cbfbb
> refactoring/CMakeLists.txt PRE-CREATION
> refactoring/debug.h PRE-CREATION
> refactoring/debug.cpp PRE-CREATION
> refactoring/documentcache.h PRE-CREATION
> refactoring/documentcache.cpp PRE-CREATION
> refactoring/interface.h PRE-CREATION
> refactoring/interface.cpp PRE-CREATION
> refactoring/kdevrefactorings.h PRE-CREATION
> refactoring/kdevrefactorings.cpp PRE-CREATION
> refactoring/kdevrefactorings_disabled.h PRE-CREATION
> refactoring/nooprefactoring.h PRE-CREATION
> refactoring/nooprefactoring.cpp PRE-CREATION
> refactoring/refactoring.h PRE-CREATION
> refactoring/refactoring.cpp PRE-CREATION
> refactoring/refactoringcontext.h PRE-CREATION
> refactoring/refactoringcontext.cpp PRE-CREATION
> refactoring/refactoringinfo.h PRE-CREATION
> refactoring/refactoringinfo.cpp PRE-CREATION
> refactoring/refactoringmanager.h PRE-CREATION
> refactoring/refactoringmanager.cpp PRE-CREATION
> refactoring/renamefielddeclrefactoring.h PRE-CREATION
> refactoring/renamefielddeclrefactoring.cpp PRE-CREATION
> refactoring/renamefielddeclturefactoring.h PRE-CREATION
> refactoring/renamefielddeclturefactoring.cpp PRE-CREATION
> refactoring/renamevardeclrefactoring.h PRE-CREATION
> refactoring/renamevardeclrefactoring.cpp PRE-CREATION
> refactoring/utils.h PRE-CREATION
> refactoring/utils.cpp PRE-CREATION
>
> Diff: https://git.reviewboard.kde.org/r/124256/diff/
>
>
> Testing
> -------
>
> Manual testing
>
>
> Thanks,
>
> Maciej Poleski
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20150706/0504de12/attachment-0001.html>
More information about the KDevelop-devel
mailing list