Skip to content

Commit 095a9cb

Browse files
authored
Merge pull request #21588 from jketema/jketema/compiler-error-bmn
C++: Silence `ExtractionRecoverableWarning`s when BMN is active
2 parents 9f27a52 + 6692f23 commit 095a9cb

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

cpp/ql/src/Diagnostics/ExtractionProblems.qll

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private newtype TExtractionProblem =
5050
/**
5151
* Superclass for the extraction problem hierarchy.
5252
*/
53-
class ExtractionProblem extends TExtractionProblem {
53+
abstract class ExtractionProblem extends TExtractionProblem {
5454
/** Gets the string representation of the problem. */
5555
string toString() { none() }
5656

@@ -65,6 +65,9 @@ class ExtractionProblem extends TExtractionProblem {
6565

6666
/** Gets the SARIF severity of this problem. */
6767
int getSeverity() { none() }
68+
69+
/** Gets the `Compilation` the problem is associated with. */
70+
abstract Compilation getCompilation();
6871
}
6972

7073
/**
@@ -96,6 +99,8 @@ class ExtractionUnrecoverableError extends ExtractionProblem, TCompilationFailed
9699
// [errors](https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10541338).
97100
result = 2
98101
}
102+
103+
override Compilation getCompilation() { result = c }
99104
}
100105

101106
/**
@@ -122,6 +127,8 @@ class ExtractionRecoverableWarning extends ExtractionProblem, TReportableWarning
122127
// [warnings](https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10541338).
123128
result = 1
124129
}
130+
131+
override Compilation getCompilation() { result = err.getCompilation() }
125132
}
126133

127134
/**
@@ -148,4 +155,6 @@ class ExtractionUnknownProblem extends ExtractionProblem, TUnknownProblem {
148155
// [warnings](https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10541338).
149156
result = 1
150157
}
158+
159+
override Compilation getCompilation() { result = err.getCompilation() }
151160
}

cpp/ql/src/Diagnostics/ExtractionWarnings.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import ExtractionProblems
1010

1111
from ExtractionProblem warning
1212
where
13-
warning instanceof ExtractionRecoverableWarning and exists(warning.getFile().getRelativePath())
13+
warning instanceof ExtractionRecoverableWarning and
14+
exists(warning.getFile().getRelativePath()) and
15+
not warning.getCompilation().buildModeNone()
1416
or
1517
warning instanceof ExtractionUnknownProblem
1618
select warning,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The "Extraction warnings" (`cpp/diagnostics/extraction-warnings`) diagnostics query no longer yields `ExtractionRecoverableWarning`s for `build-mode: none` databases. The results were found to significantly increase the sizes of the produced SARIF files, making them unprocessable in some cases.

0 commit comments

Comments
 (0)