File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
cpp/ql/src/semmle/code/cpp Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+
1
3
import semmle.code.cpp.Location
2
4
import semmle.code.cpp.Element
3
5
@@ -13,8 +15,20 @@ class Comment extends Locatable, @comment {
13
15
14
16
override Location getLocation ( ) { comments ( underlyingElement ( this ) , _, result ) }
15
17
18
+ /**
19
+ * Gets the text of this comment, including the opening `//` or `/*`, and the closing `*``/` if
20
+ * present.
21
+ */
16
22
string getContents ( ) { comments ( underlyingElement ( this ) , result , _) }
17
23
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
+ */
18
32
Element getCommentedElement ( ) {
19
33
commentbinding ( underlyingElement ( this ) , unresolveElement ( result ) )
20
34
}
You can’t perform that action at this time.
0 commit comments