Bug 272110 - Renaming a class affects CMake scripts
Summary: Renaming a class affects CMake scripts
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Build tools: CMake (show other bugs)
Version: 4.2.1
Platform: Compiled Sources Linux
: NOR major
Target Milestone: 4.2.0
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-01 01:03 UTC by Nicolás Alvarez
Modified: 2011-12-14 02:40 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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