-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathDiagnostics.qll
More file actions
68 lines (54 loc) · 2.19 KB
/
Diagnostics.qll
File metadata and controls
68 lines (54 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* Provides classes representing warnings generated during compilation.
*/
import semmle.code.cpp.Location
/** A compiler-generated error, warning or remark. */
class Diagnostic extends Locatable, @diagnostic {
/** Gets the compilation that generated this diagnostic. */
Compilation getCompilation() { diagnostic_for(underlyingElement(this), result, _, _) }
/**
* Gets the severity of the message, on a range from 1 to 5: 1=remark,
* 2=warning, 3=discretionary error, 4=error, 5=catastrophic error.
*/
int getSeverity() { diagnostics(underlyingElement(this), result, _, _, _, _) }
/** Gets the error code for this compiler message. */
string getTag() { diagnostics(underlyingElement(this), _, result, _, _, _) }
/** Holds if `s` is the error code for this compiler message. */
predicate hasTag(string s) { this.getTag() = s }
/**
* Gets the error message text associated with this compiler
* diagnostic.
*/
string getMessage() { diagnostics(underlyingElement(this), _, _, result, _, _) }
/**
* Gets the full error message text associated with this compiler
* diagnostic.
*/
string getFullMessage() { diagnostics(underlyingElement(this), _, _, _, result, _) }
/** Gets the source location corresponding to the compiler message. */
override Location getLocation() { diagnostics(underlyingElement(this), _, _, _, _, result) }
override string toString() { result = this.getMessage() }
}
/** A compiler-generated remark (milder than a warning). */
class CompilerRemark extends Diagnostic {
CompilerRemark() { this.getSeverity() = 1 }
}
/** A compiler-generated warning. */
class CompilerWarning extends Diagnostic {
CompilerWarning() { this.getSeverity() = 2 }
}
/**
* A compiler-generated discretionary error (a compile-time error that may
* be suppressed).
*/
class CompilerDiscretionaryError extends Diagnostic {
CompilerDiscretionaryError() { this.getSeverity() = 3 }
}
/** A compiler error message. */
class CompilerError extends Diagnostic {
CompilerError() { this.getSeverity() = 4 }
}
/** A compiler error that prevents compilation from continuing. */
class CompilerCatastrophe extends Diagnostic {
CompilerCatastrophe() { this.getSeverity() = 5 }
}