Bug 299393 - 'Update declaration signature' doesn't update declaration of function after change function from const to non const in definition
Summary: 'Update declaration signature' doesn't update declaration of function after c...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: git master
Platform: Mandriva RPMs Linux
: NOR normal
Target Milestone: 4.3.0
Assignee: kdevelop-bugs-null
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2012-05-04 18:08 UTC by Piotr Mierzwinski
Modified: 2013-01-17 21:42 UTC (History)
2 users (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 Piotr Mierzwinski 2012-05-04 18:08:10 UTC
I have const function (declaration in header's file and declaration in cpp file). I want non const function. Thats why I remove key word 'const' (that causes the function is constatnt) from definition of function. I press 'Update declaration signature' button (toolTip shows correct transformation). In declaration (header file) key word 'const' didn't removed.

Reproducible: Always

Steps to Reproduce:
1. Declare const function in header's file
2. Create definition of const function in cpp file
3. Save all files
4. Remove key word: const (that causes the function is constant) from definition of function
5, Choose ''Update declaration signature' from popuping menu
6. Check header file
Actual Results:  
void foo( const QString& param) const;

Expected Results:  
void foo( const QString& param);
Comment 1 Olivier.jg 2012-10-26 22:19:01 UTC
Seems to work fine now.
Comment 2 Piotr Mierzwinski 2012-11-09 18:42:00 UTC
Sorry, but doesn't. Works partially. Only if function has not parameters. Let's try with:
header file:
void foo2( const QString & str ) const;

cpp file:
void foo2( const QString & str ) const
{
     qDebug() << "aa";
}

1. Remove const in cpp file (i.e.: press Ctrl+Backspace when cursor is at end of method signature)
2, Choose ''Update declaration signature' in popuping menu
3. Check header file

Actual Results:  
void foo( const QString& str) const;

Expected Results:  
void foo( const QString& str);


I tested on Mandriva 2011.0 (KDE-4.6.5), qt-4.7.4) and KDevelop 4.4.1. System newly installed (and updated) on VirtualBox 4.2.0. KDevelop builded from official sources.
Comment 3 Milian Wolff 2012-11-09 19:58:25 UTC
indeed, this is broken
Comment 4 Piotr Mierzwinski 2013-01-15 19:43:30 UTC
In branch: master is still broken.
Comment 5 Milian Wolff 2013-01-17 21:42:53 UTC
Git commit 15ef959f791389c1cf3b4a8e31751191890098e4 by Milian Wolff.
Committed on 17/01/2013 at 22:40.
Pushed by mwolff into branch '4.5'.

Properly cope with function signatures containing whitespace.

The main issue is that our function contexts don't go from the
opening paren to the closing paren, but from the first to the last
token inside the closing parens. Thus if you put whitespace padding
in there the old code broke down...

M  +23   -15   languages/cpp/codegen/adaptsignatureaction.cpp
M  +9    -0    languages/cpp/tests/test_cppassistants.cpp

http://commits.kde.org/kdevelop/15ef959f791389c1cf3b4a8e31751191890098e4