| Summary: | Quick fix for catch by value should propose to replace by a const reference | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Corentin Jabot <corentinjabot> | ||||||||||
| Component: | cdt-codan | Assignee: | Marc-André Laperle <malaperle> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | Elena Laskavaia <elaskavaia.cdt> | ||||||||||
| Severity: | enhancement | ||||||||||||
| Priority: | P3 | CC: | cdtdoug, malaperle, yevshif | ||||||||||
| Version: | 8.0 | ||||||||||||
| Target Milestone: | 8.0.1 | ||||||||||||
| Hardware: | All | ||||||||||||
| OS: | All | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Corentin Jabot
Created attachment 198105 [details]
added catch by const ref
So I assume we want to keep both options as possibilities?
can you provide a junit test please? I see that this appends 'const &' instead of pre-pending const and appending &. I think most people do const Exception &, not Exception const &, what do you think ? And it would be cool to have the const & quick fix listed first in the list of quick fixes but I'm not sure how easy it is to do that. Created attachment 199945 [details]
quick fix + test
Added test cases.
Also followed the suggestion to catch (const Exception & name).
Alena, does Codan already have a facility for prioritizing quick fixes? I agree that it sounds useful.
Created attachment 199946 [details]
quick fix + test
(Fixed some comments)
Created attachment 200053 [details] quick fix + test, modified Hi Tomasz. I modified a bit your patch: - Changed CatchByReference and CatchByConstReference to use pretty much the same logic (it's just a static method...) - Handle the case where there is no declName (bug 352263) and add related test cases - Add test to suite - Minor copyright updates What do you think of this patch? I've diffed the patches (gits gets helpful :)) and reviewed your changes. I appreciate this version, thank you for the valuable input! Thanks! Fixed in cdt_8_0 and master > 20110721. *** cdt git genie on behalf of 348191 ***
Bug 348191 - Quick fix for catch by value should propose to replace by a
const reference
Bug 352263 - [qf] Catch by reference quick fix places & at a wrong place
when no space after the type
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=db669ba9633e67facd61a36cc34361d8363e1e56
*** cdt git genie on behalf of 348191 ***
Bug 348191 - Quick fix for catch by value should propose to replace by a
const reference
Bug 352263 - [qf] Catch by reference quick fix places & at a wrong place
when no space after the type
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=f434c8c5564989c2c0a578e74bde0ff7b70678de
|