Skip to content

Commit f8b6e07

Browse files
committed
C++: Added QLDoc for Element.qll-Include.qll
1 parent 1c20714 commit f8b6e07

File tree

8 files changed

+53
-0
lines changed

8 files changed

+53
-0
lines changed

cpp/ql/src/semmle/code/cpp/Element.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Provides the `Element` class, which is the base class for all classes representing C or C++
3+
* program elements.
4+
*/
5+
16
import semmle.code.cpp.Location
27
private import semmle.code.cpp.Enclosing
38
private import semmle.code.cpp.internal.ResolveClass
@@ -261,8 +266,14 @@ private predicate isFromUninstantiatedTemplateRec(Element e, Element template) {
261266
class StaticAssert extends Locatable, @static_assert {
262267
override string toString() { result = "static_assert(..., \"" + getMessage() + "\")" }
263268

269+
/**
270+
* Gets the expression which this static assertion ensures is true.
271+
*/
264272
Expr getCondition() { static_asserts(underlyingElement(this), unresolveElement(result), _, _) }
265273

274+
/**
275+
* Gets the message which will be reported by the compiler if this static assertion fails.
276+
*/
266277
string getMessage() { static_asserts(underlyingElement(this), _, result, _) }
267278

268279
override Location getLocation() { static_asserts(underlyingElement(this), _, _, result) }

cpp/ql/src/semmle/code/cpp/Enclosing.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides predicates for finding the smallest element that encloses an expression or statement.
3+
*/
4+
15
import cpp
26

37
/**

cpp/ql/src/semmle/code/cpp/Enum.qll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes representing C/C++ enums and enum constants.
3+
*/
4+
15
import semmle.code.cpp.Type
26
private import semmle.code.cpp.internal.ResolveClass
37

@@ -19,6 +23,17 @@ class Enum extends UserType, IntegralOrEnumType {
1923
/** Gets an enumerator of this enumeration. */
2024
EnumConstant getAnEnumConstant() { result.getDeclaringEnum() = this }
2125

26+
/**
27+
* Gets the enumerator of this enumeration that was declared at the zero-based position `index`.
28+
* For example, `zero` is at index 2 in the following declaration:
29+
* ```
30+
* enum ReversedOrder {
31+
* two = 2,
32+
* one = 1,
33+
* zero = 0
34+
* };
35+
* ```
36+
*/
2237
EnumConstant getEnumConstant(int index) {
2338
enumconstants(unresolveElement(result), underlyingElement(this), index, _, _, _)
2439
}

cpp/ql/src/semmle/code/cpp/Field.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes representing C structure members and C++ non-static member variables.
3+
*/
4+
15
import semmle.code.cpp.Variable
26
import semmle.code.cpp.Enum
37
import semmle.code.cpp.exprs.Access

cpp/ql/src/semmle/code/cpp/File.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes representing files and folders.
3+
*/
4+
15
import semmle.code.cpp.Element
26
import semmle.code.cpp.Declaration
37
import semmle.code.cpp.metrics.MetricFile

cpp/ql/src/semmle/code/cpp/FriendDecl.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides a class representing C++ `friend` declarations.
3+
*/
4+
15
import semmle.code.cpp.Declaration
26
private import semmle.code.cpp.internal.ResolveClass
37

cpp/ql/src/semmle/code/cpp/Function.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes for working with functions, including C++ constructors, destructors,
3+
* user-defined operators, and template functions.
4+
*/
15
import semmle.code.cpp.Location
26
import semmle.code.cpp.Member
37
import semmle.code.cpp.Class
@@ -891,8 +895,10 @@ class Constructor extends MemberFunction {
891895
* A function that defines an implicit conversion.
892896
*/
893897
abstract class ImplicitConversionFunction extends MemberFunction {
898+
/** Gets the type this `ImplicitConversionFunction` takes as input. */
894899
abstract Type getSourceType();
895900

901+
/** Gets the type this `ImplicitConversionFunction` converts to. */
896902
abstract Type getDestType();
897903
}
898904

cpp/ql/src/semmle/code/cpp/Include.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Provides classes representing C/C++ `#include`, `#include_next`, and `#import` preprocessor
3+
* directives.
4+
*/
5+
16
import semmle.code.cpp.Preprocessor
27

38
/**

0 commit comments

Comments
 (0)