Merge pull request #5922 from AlexDenisov/ref-qualifiers

C++: Add ref qualifiers
This commit is contained in:
Ian Lynagh
2021-05-21 17:35:57 +01:00
committed by GitHub
6 changed files with 19 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
lgtm,codescanning
* lvalue/rvalue ref qualifiers are now accessible via the new predicates on `MemberFunction`(`.isLValueRefQualified`, `.isRValueRefQualified`, and `isRefQualified`).

View File

@@ -48,6 +48,15 @@ class MemberFunction extends Function {
/** Holds if this member is public. */
predicate isPublic() { this.hasSpecifier("public") }
/** Holds if this declaration has the lvalue ref-qualifier */
predicate isLValueRefQualified() { hasSpecifier("&") }
/** Holds if this declaration has the rvalue ref-qualifier */
predicate isRValueRefQualified() { hasSpecifier("&&") }
/** Holds if this declaration has a ref-qualifier */
predicate isRefQualified() { isLValueRefQualified() or isRValueRefQualified() }
/** Holds if this function overrides that function. */
predicate overrides(MemberFunction that) {
overrides(underlyingElement(this), unresolveElement(that))

View File

@@ -26,6 +26,8 @@
| clang_ms.cpp:17:1:17:32 | #pragma |
| clang_ms.cpp:18:1:18:31 | #pragma |
| file://:0:0:0:0 | |
| file://:0:0:0:0 | & |
| file://:0:0:0:0 | && |
| file://:0:0:0:0 | (global namespace) |
| file://:0:0:0:0 | (unnamed parameter 0) |
| file://:0:0:0:0 | (unnamed parameter 0) |

View File

@@ -1,4 +1,6 @@
| file://:0:0:0:0 | |
| file://:0:0:0:0 | & |
| file://:0:0:0:0 | && |
| file://:0:0:0:0 | (global namespace) |
| file://:0:0:0:0 | (unnamed parameter 0) |
| file://:0:0:0:0 | (unnamed parameter 0) |

View File

@@ -1,4 +1,6 @@
| file://:0:0:0:0 | |
| file://:0:0:0:0 | & |
| file://:0:0:0:0 | && |
| file://:0:0:0:0 | (composite<int> *)... |
| file://:0:0:0:0 | (composite<int> *)... |
| file://:0:0:0:0 | (global namespace) |

View File

@@ -1,4 +1,6 @@
| file://:0:0:0:0 | | Other |
| file://:0:0:0:0 | & | Other |
| file://:0:0:0:0 | && | Other |
| file://:0:0:0:0 | (global namespace) | Other |
| file://:0:0:0:0 | (unnamed global/namespace variable) | Other |
| file://:0:0:0:0 | _Complex __float128 | Other |