Bug 272110

Summary: Renaming a class affects CMake scripts
Product: [Applications] kdevelop Reporter: Nicolás Alvarez <nalvarez>
Component: Build tools: CMakeAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: major CC: aleixpol
Priority: NOR    
Version: 4.2.1   
Target Milestone: 4.2.0   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Nicolás Alvarez 2011-05-01 01:03:58 UTC
If a class has the same name as a CMake target, they are considered the same for the purpose of renaming.

CMakeLists.txt:
ADD_EXECUTABLE(BugReport foo.cpp)

foo.cpp:
struct BugReport {
    BugReport() {}
};
int main() {
    BugReport a;
}

Right click on any of the three BugReport identifiers in the C++ code, and select Rename. The rename dialog will only show the three uses in the C++ code, and nothing from CMakeLists.txt, as expected.

Choose a new name and accept. The CMake target in CMakeLists.txt will get renamed too. This is incorrect.
Comment 1 Nicolás Alvarez 2011-05-01 01:24:22 UTC
Now I remember: the reason it doesn't appear in the rename dialog is that the CMake language handler doesn't have a ParseJob.
Comment 2 Aleix Pol 2011-06-05 14:41:04 UTC
That's not the reason. The reason is that when we find a use we first check if it is declared before, and DUChain reports those findings in the _whole_ project...
Comment 3 Aleix Pol 2011-12-14 02:40:04 UTC
Git commit 92cd00cd189a0520cd8aa25dca0fb1e4d4c4720c by Aleix Pol.
Committed on 14/12/2011 at 03:38.
Pushed by apol into branch 'master'.

In cmake, Don't reuse declarations if they are not in a cmake script.

BUG: 272110

M  +12   -2    projectmanagers/cmake/parser/cmakeprojectvisitor.cpp
M  +4    -0    projectmanagers/cmake/tests/cmakeduchaintest.cpp

http://commits.kde.org/kdevelop/92cd00cd189a0520cd8aa25dca0fb1e4d4c4720c