Skip to content

Commit e17b486

Browse files
authored
Merge pull request github#3593 from rdmarsh2/rdmarsh/cpp/add-qldoc-2
C++: Add QLDoc for AST classes up to Include.qll
2 parents 7265e94 + 3460b9d commit e17b486

File tree

14 files changed

+79
-0
lines changed

14 files changed

+79
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Provides a class and predicate for recognizing files that are likely to have been generated
3+
* automatically.
4+
*/
5+
16
import semmle.code.cpp.Comments
27
import semmle.code.cpp.File
38
import semmle.code.cpp.Preprocessor

cpp/ql/src/semmle/code/cpp/Class.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++ classes, including structs, unions, and template classes.
3+
*/
4+
15
import semmle.code.cpp.Type
26
import semmle.code.cpp.UserType
37
import semmle.code.cpp.metrics.MetricClass

cpp/ql/src/semmle/code/cpp/Comments.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 and C++ comments.
3+
*/
4+
15
import semmle.code.cpp.Location
26
import semmle.code.cpp.Element
37

cpp/ql/src/semmle/code/cpp/Compilation.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 individual compiler invocations that occurred during the build.
3+
*/
4+
15
import semmle.code.cpp.File
26

37
/*

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes for working with C and C++ declarations.
3+
*/
4+
15
import semmle.code.cpp.Element
26
import semmle.code.cpp.Specifier
37
import semmle.code.cpp.Namespace

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes representing warnings generated during compilation.
3+
*/
4+
15
import semmle.code.cpp.Location
26

37
/** A compiler-generated error, warning or remark. */

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

0 commit comments

Comments
 (0)