Query module AV Rule 81

name
AV Rule 81
description
The assignment operator shall handle self-assignment correctly.
kind
problem
id
cpp/jsf/av-rule-81
problem.severity
error
tags
correctness external/jsf

Imports

cpp

Provides classes and predicates for working with C/C++/ObjC/ObjC++ code.

Predicates

hasResource

Test whether a class has a resource that needs management. Value class types are okay because they get their semantics from their assignment operator. Primitive types are fine (no management needed). Constant and reference values are okay too (they can’t be changed anyway). All that remains are pointer types.

Classes

ReferenceCopyAssignmentOperator

A copy assignment operator taking its parameter by reference. For our purposes, copy assignment operators taking parameters by value are likely fine, since the copy already happened