CodeQL library for C/C++
codeql/cpp-all 2.0.2 (changelog, source)
Search

Module MemberFunction

Provides classes for working with C++ member functions, constructors, destructors, and user-defined operators.

Import path

import semmle.code.cpp.MemberFunction

Imports

cpp

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

Classes

ConstMemberFunction

A const C++ member function [N4140 9.3.1/4]. A const function has the const specifier and does not modify the state of its class. For example the member function day in the following code:

Constructor

A C++ constructor [N4140 12.1]. For example the function MyClass in the following code is a constructor: class MyClass { public: MyClass() { ... } };

ConversionOperator

A C++ conversion operator [N4140 12.3.2]. For example the function operator int in the following code is a ConversionOperator: class MyClass { public: operator int(); };

CopyAssignmentOperator

A C++ copy assignment operator [N4140 12.8]. For example the function operator= in the following code is a CopyAssignmentOperator: class MyClass { public: MyClass &operator=(const MyClass &other); };

CopyConstructor

A C++ copy constructor [N4140 12.8]. For example the function MyClass in the following code is a CopyConstructor: class MyClass { public: MyClass(const MyClass &from) { ... } };

Destructor

A C++ destructor [N4140 12.4]. For example the function ~MyClass in the following code is a destructor: class MyClass { public: ~MyClass() { ... } };

ImplicitConversionFunction

A function that defines an implicit conversion.

MemberFunction

A C++ function declared as a member of a class [N4140 9.3]. This includes static member functions. For example the functions MyStaticMemberFunction and MyMemberFunction in:

MoveAssignmentOperator

A C++ move assignment operator [N4140 12.8]. For example the function operator= in the following code is a MoveAssignmentOperator: class MyClass { public: MyClass &operator=(MyClass &&other); };

MoveConstructor

A C++ move constructor [N4140 12.8]. For example the function MyClass in the following code is a MoveConstructor: class MyClass { public: MyClass(MyClass &&from) { ... } };

NoArgConstructor

A C++ constructor that takes no arguments (‘default’ constructor). This is the constructor that is invoked when no initializer is given. For example the function MyClass in the following code is a NoArgConstructor: class MyClass { public: MyClass() { ... } };

PureVirtualFunction

A C++ pure virtual function [N4140 10.4]. For example the first function called myVirtualFunction in the following code:

VirtualFunction

A C++ virtual function. For example the two functions called myVirtualFunction in the following code are each a VirtualFunction: