aboutsummaryrefslogtreecommitdiff
path: root/clang/utils
diff options
context:
space:
mode:
authorMarco Antognini <marco.antognini@sonarsource.com>2022-05-03 16:07:06 +0200
committerMarco Antognini <marco.antognini@sonarsource.com>2022-06-20 09:46:07 +0200
commit0ad4f29b545d849820f0025736c9559c5c439032 (patch)
tree20e4dc29aca8ec6c789b0668a785148ee8edfd7c /clang/utils
parente15fef41709a226a45d321ebb9cd58260cb97b02 (diff)
downloadllvm-0ad4f29b545d849820f0025736c9559c5c439032.zip
llvm-0ad4f29b545d849820f0025736c9559c5c439032.tar.gz
llvm-0ad4f29b545d849820f0025736c9559c5c439032.tar.bz2
[analyzer] SATest: Weaken assumption about HTML files
Instead of assuming there is an HTML file for each diagnostics, consider the HTML files only when they exist, individually of each other. After generating the reference data, running python /scripts/SATest.py build --projects simbody was resulting in this error: File "/scripts/CmpRuns.py", line 250, in read_single_file assert len(d['HTMLDiagnostics_files']) == 1 KeyError: 'HTMLDiagnostics_files' Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D126197
Diffstat (limited to 'clang/utils')
-rw-r--r--clang/utils/analyzer/CmpRuns.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/utils/analyzer/CmpRuns.py b/clang/utils/analyzer/CmpRuns.py
index 7afe865..61fd044 100644
--- a/clang/utils/analyzer/CmpRuns.py
+++ b/clang/utils/analyzer/CmpRuns.py
@@ -242,17 +242,20 @@ class AnalysisRun:
return
# Extract the HTML reports, if they exists.
- if 'HTMLDiagnostics_files' in data['diagnostics'][0]:
- htmlFiles = []
- for d in data['diagnostics']:
+ htmlFiles = []
+ for d in data['diagnostics']:
+ if 'HTMLDiagnostics_files' in d:
# FIXME: Why is this named files, when does it have multiple
# files?
assert len(d['HTMLDiagnostics_files']) == 1
htmlFiles.append(d.pop('HTMLDiagnostics_files')[0])
- else:
- htmlFiles = [None] * len(data['diagnostics'])
+ else:
+ htmlFiles.append(None)
report = AnalysisReport(self, data.pop('files'))
+ # Python 3.10 offers zip(..., strict=True). The following assertion
+ # mimics it.
+ assert len(data['diagnostics']) == len(htmlFiles)
diagnostics = [AnalysisDiagnostic(d, report, h)
for d, h in zip(data.pop('diagnostics'), htmlFiles)]