Closed Bug 1662652 Opened 4 years ago Closed 4 years ago

Add static analysis for non-standard quasi-move operations

Categories

(Developer Infrastructure :: Source Code Analysis, task)

Tracking

(firefox88 fixed)

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: sg, Assigned: sg)

References

Details

Attachments

(1 file)

There are several specific ways of using more general operations to effectively move objects:

  1. Via custom member functions e.g. forget in case of smart pointers
  2. Via a generic swap (std::swap) where one of the arguments is empty or is going to be discarded
  3. Via a custom swap (e.g. SwapElements for arrays) where one of the arguments is empty or is going to be discarded

Not using std::move may have various disadvantages, including:

  • The generated code may be suboptimal since the operations used are more general
  • The source code is harder to understand since other concepts are used in place of standard move semantics

While Bug 1611415 removed many occurrences of the first item based on a preliminary version of a static analysis (that still produced many false positives), and several occurrences of the last item were removed manually in Bug 1654992, an improved static analysis could identify the remaining occurrences and prevent the introduction of new ones.

Assignee: nobody → sgiesecke
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: