Skip to content

Commit a4d7bfb

Browse files
authored
Merge pull request github#5031 from MathiasVP/remove-linear-scan-of-functions-2
C++: Remove more linear scans
2 parents 6d952bd + c61dec1 commit a4d7bfb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ class CStyleComment extends Comment {
5050
* ```
5151
*/
5252
class CppStyleComment extends Comment {
53-
CppStyleComment() { this.getContents().prefix(2) = "//" }
53+
CppStyleComment() { this.getContents().matches("//%") }
5454
}

cpp/ql/src/semmle/code/cpp/commons/Synchronization.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ abstract class MutexType extends Type {
8787
private Function mustlockCandidate() {
8888
exists(string name | name = result.getName() |
8989
name = "lock" or
90-
name.suffix(name.length() - 10) = "mutex_lock"
90+
name.matches("%mutex\\_lock")
9191
)
9292
}
9393

@@ -97,7 +97,7 @@ private Function mustlockCandidate() {
9797
private Function trylockCandidate() {
9898
exists(string name | name = result.getName() |
9999
name = "try_lock" or
100-
name.suffix(name.length() - 13) = "mutex_trylock"
100+
name.matches("%mutex\\_trylock")
101101
)
102102
}
103103

@@ -107,7 +107,7 @@ private Function trylockCandidate() {
107107
private Function unlockCandidate() {
108108
exists(string name | name = result.getName() |
109109
name = "unlock" or
110-
name.suffix(name.length() - 12) = "mutex_unlock"
110+
name.matches("%mutex\\_unlock")
111111
)
112112
}
113113

0 commit comments

Comments
 (0)