File tree Expand file tree Collapse file tree
cpp/ql/src/semmle/code/cpp Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+
2+
13import semmle.code.cpp.Location
24import 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 }
You can’t perform that action at this time.
0 commit comments