CodeQL library for C/C++
Search

Module Class

Provides classes representing C++ classes, including structs, unions, and template classes.

Import path

import semmle.code.cpp.Class

Imports

Linkage

Proivdes the LinkTarget class representing linker invocations during the build process.

MetricClass
Type

Provides a hierarchy of classes for modeling C/C++ types.

UserType

Provides classes for modeling user-defined types such as classes, typedefs and enums.

Classes

AbstractClass

An “abstract class”, in other words a class/struct that contains at least one pure virtual function.

Class

A class type [N4140 9].

ClassDerivation

A class derivation, for example the public B in the following code: class D : public B { ... };

ClassTemplateInstantiation

A class that is an instantiation of a template. For example in the following code there is a MyTemplateClass<int> instantiation: ``` template class MyTemplateClass { … };

ClassTemplateSpecialization

A specialization of a class template (this may be a full or partial template specialization - see FullClassTemplateSpecialization and PartialClassTemplateSpecialization).

FullClassTemplateSpecialization

A full specialization of a class template. For example MyTemplateClass<int> in the following code is a FullClassTemplateSpecialization: ``` template class MyTemplateClass { … };

Interface

An “interface” is a class that only contains pure virtual functions (and contains at least one such function). For example: class MyInterfaceClass { public: virtual void myMethod1() = 0; virtual void myMethod2() = 0; };

LocalClass

A class, struct or union that is directly enclosed by a function. For example the struct in the following code is a LocalClass: void myFunction() { struct { int x; int y; } vec = { 1, 2 }; };

NestedClass

A class, struct or union that is declared within another class. For example the struct PairT in the following code is a nested class: template<class T> class MyTemplateClass { public: struct PairT { T first, second; }; };

PartialClassTemplateSpecialization

A partial specialization of a class template. For example MyTemplateClass<int, T> in the following code is a PartialClassTemplateSpecialization: ``` template<class S, class T> class MyTemplateClass { … };

ProxyClass

The proxy class (where needed) associated with a template parameter, as in the following code: template <typename T> struct S : T { // the type of this T is a proxy class ... };

TemplateClass

A class template (this class also finds partial specializations of class templates). For example in the following code there is a MyTemplateClass<T> template: template<class T> class MyTemplateClass { ... }; Note that this does not include template instantiations, and full specializations. See ClassTemplateInstantiation and FullClassTemplateSpecialization.

VirtualBaseClass

A class/struct that is the base of some virtual class derivation. For example MyBaseClass in the following code is a VirtualBaseClass of MyClass: ``` class MyBaseClass { … };

VirtualClassDerivation

A class/struct derivation that is virtual. For example the derivation in the following code is a VirtualClassDerivation: class MyClass : public virtual MyBaseClass { ... };