[all-commits] [llvm/llvm-project] 730935: [analyzer] Fix scan-build report deduplication.

NoQ via All-commits all-commits at lists.llvm.org
Thu Aug 26 13:39:34 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 73093599287cc6d546ac46652ee781789d7de61f
      https://github.com/llvm/llvm-project/commit/73093599287cc6d546ac46652ee781789d7de61f
  Author: Artem Dergachev <artem.dergachev at gmail.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M clang/include/clang/Analysis/PathDiagnostic.h
    M clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
    M clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
    M clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
    M clang/test/Analysis/analyzer-config.c
    A clang/test/Analysis/scan-build/Inputs/deduplication/1.c
    A clang/test/Analysis/scan-build/Inputs/deduplication/2.c
    A clang/test/Analysis/scan-build/Inputs/deduplication/header.h
    A clang/test/Analysis/scan-build/deduplication.test
    M clang/test/Analysis/scan-build/rebuild_index/rebuild_index.test
    R clang/test/Analysis/scan-build/rebuild_index/report-3.html
    A clang/test/Analysis/scan-build/rebuild_index/subdirectory/report-3.html
    R clang/test/Analysis/scan-build/rebuild_index/subdirectory/report-4.html
    M clang/tools/scan-build/bin/scan-build

  Log Message:
  -----------
  [analyzer] Fix scan-build report deduplication.

The previous behavior was to deduplicate reports based on md5 of the
html file. This algorithm might have worked originally but right now
HTML reports contain information rich enough to make them virtually
always distinct which breaks deduplication entirely.

The new strategy is to (finally) take advantage of IssueHash - the
stable report identifier provided by clang that is the same if and only if
the reports are duplicates of each other.

Additionally, scan-build no longer performs deduplication on its own.
Instead, the report file name is now based on the issue hash,
and clang instances will silently refuse to produce a new html file
when a duplicate already exists. This eliminates the problem entirely.

The '-analyzer-config stable-report-filename' option is deprecated
because report filenames are no longer unstable. A new option is
introduced, '-analyzer-config verbose-report-filename', to produce
verbose file names that look similar to the old "stable" file names.
The old option acts as an alias to the new option.

Differential Revision: https://reviews.llvm.org/D105167




More information about the All-commits mailing list