Skip to content

Commit de29d93

Browse files
committed
C++: add method qldoc for Comment.qll
1 parent 7c5c9ea commit de29d93

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
import semmle.code.cpp.Location
24
import semmle.code.cpp.Element
35

@@ -13,8 +15,20 @@ class Comment extends Locatable, @comment {
1315

1416
override Location getLocation() { comments(underlyingElement(this), _, result) }
1517

18+
/**
19+
* Gets the text of this comment, including the opening `//` or `/*`, and the closing `*``/` if
20+
* present.
21+
*/
1622
string getContents() { comments(underlyingElement(this), result, _) }
1723

24+
/**
25+
* Gets the AST element this comment is associated with. For example, the comment in the
26+
* following code is associated with the declaration of `j`.
27+
* ```
28+
* int i;
29+
* int j; // Comment on j
30+
* ```
31+
*/
1832
Element getCommentedElement() {
1933
commentbinding(underlyingElement(this), unresolveElement(result))
2034
}

0 commit comments

Comments
 (0)