We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent afdd7b0 commit 609ed70Copy full SHA for 609ed70
ql/ql/src/queries/style/AlertMessage.ql
@@ -185,12 +185,16 @@ String doubleWhitespace(Select sel) {
185
result.getValue().regexpMatch(".*\\s\\s.*")
186
}
187
188
+import codeql.GlobalValueNumbering as GVN
189
+
190
/**
191
* Gets an expression that repeats the alert-loc as a link.
192
*/
-VarAccess getAlertLocLink(Select sel) {
- // TODO: Get this to work with GVN. I got an infinite loop when I tried.
193
- result = sel.getExpr(0).(VarAccess).getDeclaration().getAnAccess() and
+AstNode getAlertLocLink(Select sel) {
194
+ exists(GVN::ValueNumber vn |
195
+ result = vn.getAnExpr() and
196
+ sel.getExpr(0) = vn.getAnExpr()
197
+ ) and
198
exists(int msgIndex | sel.getExpr(msgIndex) = sel.getMessage() |
199
result = sel.getExpr(any(int i | i > msgIndex))
200
)
0 commit comments