Skip to content

Please annotate findings in tidy bugprone-exception-escape #87422

@jackua22

Description

@jackua22

When tidy reports a violations, it looks like

an exception may be thrown in function 'main' which should not throw exceptions [bugprone-exception-escape]
 2801 | int main(int argc, char *argv[])
      |     ^

or

somefile.cpp:2425:11: an exception may be thrown in function 'operator=' which should not throw exceptions [bugprone-exception-escape]
 2425 |   Data& operator=(Data&&) = default;

It is not so actionable or ergonomic. It is an important finding, must be fixed, but it takes a lot of time to find the cause. One line of a note will save a lot of efforts.
In the last example, I opened CLion, which immediately highlighted the move constructor with a message "Move constructor should be marked noexcept". Simple and clear. Yes, we run tidy with select checks, and performance-noexcept-move-constructor is not in the same group as bugprone-exception-escape.

In the first example, I did not even find the source of an exception, it can be thousands lines of somebody's code. Yes, I know, I can add a big catch and get the source control ownership of all the lines in main function. But it would help if the tool explains its findings.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions