Skip to content

Commit ab23507

Browse files
committed
C++: Add ref qualifiers
1 parent c4f604b commit ab23507

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lgtm,codescanning
2+
* lvalue/rvalue ref qualifiers are now accessible via the new predicates on `MemberFunction`(`.isLValueRefQualified`, `.isRValueRefQualified`, and `isRefQualified`).

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ class MemberFunction extends Function {
4848
/** Holds if this member is public. */
4949
predicate isPublic() { this.hasSpecifier("public") }
5050

51+
/** Holds if this declaration has the lvalue ref-qualifier */
52+
predicate isLValueRefQualified() { hasSpecifier("&") }
53+
54+
/** Holds if this declaration has the rvalue ref-qualifier */
55+
predicate isRValueRefQualified() { hasSpecifier("&&") }
56+
57+
/** Holds if this declaration has a ref-qualifier */
58+
predicate isRefQualified() { isLValueRefQualified() or isRValueRefQualified() }
59+
5160
/** Holds if this function overrides that function. */
5261
predicate overrides(MemberFunction that) {
5362
overrides(underlyingElement(this), unresolveElement(that))

0 commit comments

Comments
 (0)