This revision was automatically updated to reflect the committed changes. Closed by commit rG0ad4f29b545d: [analyzer] SATest: Weaken assumption about HTML files (authored by mantognini).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126197/new/ https://reviews.llvm.org/D126197 Files: clang/utils/analyzer/CmpRuns.py Index: clang/utils/analyzer/CmpRuns.py =================================================================== --- clang/utils/analyzer/CmpRuns.py +++ clang/utils/analyzer/CmpRuns.py @@ -242,17 +242,20 @@ 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)]
Index: clang/utils/analyzer/CmpRuns.py =================================================================== --- clang/utils/analyzer/CmpRuns.py +++ clang/utils/analyzer/CmpRuns.py @@ -242,17 +242,20 @@ 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)]
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits