Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A15-4-2: Ignore elided calls when calculating the exception graph #158

Open
lcartey opened this issue Jan 6, 2023 · 2 comments
Open

A15-4-2: Ignore elided calls when calculating the exception graph #158

lcartey opened this issue Jan 6, 2023 · 2 comments
Assignees
Labels
Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-High top-25-fps user-report Issue reported by an end user of CodeQL Coding Standards

Comments

@lcartey
Copy link
Collaborator

lcartey commented Jan 6, 2023

Affected rules

  • A15-4-2

Description

Copy elision allows the compiler to omit copy and move construction in certain circumstances. Some of these circumstances are considered "mandatory" - i.e. the compiler must omit the explicit construction - and in those circumstances copy and move constructors may never be called.

If you have move/copy constructors which are never expected to be called because they are always elided, you may decide to throw an exception from the copy/move constructor to enforce that it is only used in circumstances where the elision occurs. As our call graph does not currently reflect the mandatory elision of functions, this can cause false positives.

Example

// `foo` is only used in circumstances where it is elided, so this exception is never thrown in practice
constexpr foo(const foo&) : dummy() {
  throw some_bad_exception();
};
@lcartey lcartey added Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address Impact-Low false positive/false negative An issue related to observed false positives or false negatives. labels Jan 6, 2023
@lcartey
Copy link
Collaborator Author

lcartey commented Jan 6, 2023

See also:
#20
As it appears we do sometimes elide the copy/move constructors.

@lcartey lcartey added Impact-High user-report Issue reported by an end user of CodeQL Coding Standards top-25-fps and removed Impact-Low labels Mar 3, 2023
@lcartey
Copy link
Collaborator Author

lcartey commented Mar 17, 2023

@lcartey lcartey self-assigned this Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-High top-25-fps user-report Issue reported by an end user of CodeQL Coding Standards
Projects
Development

No branches or pull requests

2 participants