Bug 188180 - "implement function" should preserve exceptions specification
Summary: "implement function" should preserve exceptions specification
Status: CONFIRMED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 277009 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-03-26 18:10 UTC by Eugene Shalygin
Modified: 2020-10-14 01:19 UTC (History)
6 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 Eugene Shalygin 2009-03-26 18:10:13 UTC
Version:            (using Devel)
Compiler:          gcc 4.3.3 
OS:                Linux
Installed from:    Compiled sources

"Implelent function" does not preserve exceptions specification from function declaration

Steps to reproduce:
1. decalre a method with some throw (...) in header
2. switch to cpp
3. invoke "implement function"
4. function definition without exception specification will appears
Comment 1 Rolf Eike Beer 2013-02-04 17:34:39 UTC
*** Bug 277009 has been marked as a duplicate of this bug. ***
Comment 2 Guillaume Racicot 2017-04-27 00:56:46 UTC
It still happen with clang version. When a function is marked `noexcept`, or `throw()`, I expect the generated implemented function to have these specification also. Right now, It's not generated and the generated function does not compile/match the header.
Comment 3 Amish Naidu 2018-10-19 14:27:36 UTC
libclang doesn't seem to expose any way to query the expression for a computed noexcept and similarly the types inside a throw(..)
Comment 4 Guillermo Frontera 2020-09-23 14:44:50 UTC
(In reply to Amish Naidu from comment #3)
> libclang doesn't seem to expose any way to query the expression for a
> computed noexcept and similarly the types inside a throw(..)

Is this still true? It's been almost two years. Perhaps the function clang_getCursorExceptionSpecificationType does the job now.
Comment 5 Guillermo Frontera 2020-09-23 16:52:55 UTC
I have submitted a merge request to fix this at least in the case where the specification is noexcept (no expression provided) or throw() (no types provided).
Comment 6 Aleix Pol 2020-10-14 01:19:34 UTC
Git commit ad50f05907ab9d25e80dfa2e5ee203b92dd7aa58 by Aleix Pol Gonzalez, on behalf of Guillermo Frontera.
Committed on 14/10/2020 at 01:18.
Pushed by apol into branch 'master'.

Add exception specification to function signatures

When using the IDE to generate function definitions, some elements
from the function signature are omitted. One of those are exception
specifications. This commit adds exception specification to function
signatures if the specification is `noexcept` (no expression
 provided) or `throw()` (no types provided). More complex
specifications cannot be added for now as libclang does not provide
the required information.

M  +8    -0    plugins/clang/tests/test_codecompletion.cpp
M  +11   -0    plugins/clang/util/clangutils.cpp

https://invent.kde.org/kdevelop/kdevelop/commit/ad50f05907ab9d25e80dfa2e5ee203b92dd7aa58