[all-commits] [llvm/llvm-project] 48f97e: [FlowSensitive] Log analysis progress for debuggin...

Sam McCall via All-commits all-commits at lists.llvm.org
Thu Mar 23 03:43:27 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 48f97e5751372b4a64144605c5e9f7e5e13e382a
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2023-03-23 (Thu, 23 Mar 2023)

  Changed paths:
    M clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h
    M clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
    A clang/include/clang/Analysis/FlowSensitive/Logger.h
    M clang/lib/Analysis/FlowSensitive/CMakeLists.txt
    M clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
    A clang/lib/Analysis/FlowSensitive/Logger.cpp
    M clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
    M clang/unittests/Analysis/FlowSensitive/CMakeLists.txt
    A clang/unittests/Analysis/FlowSensitive/LoggerTest.cpp

  Log Message:
  [FlowSensitive] Log analysis progress for debugging purposes

The goal is to be able to understand how the analysis executes, and what its
incremental and final findings are, by enabling logging and reading the logs.
This should include both framework and analysis-specific information.

Ad-hoc printf-debugging doesn't seem sufficient for my understanding, at least.
Being able to check in logging, turn it on in a production binary, and quickly
find particular analysis steps within complex functions seem important.

This can be enabled programmatically through DataflowAnalysisOptions, or
via the flag -dataflow-log. (Works in unittests, clang-tidy, standalone

Important missing pieces here:
 - a logger implementation that produces an interactive report (HTML file)
   which can be navigated via timeline/code/CFG.
   (I think the Logger interface is sufficient for this, but need to prototype).
 - display of the application-specific lattice
 - more useful display for the built-in environment
   (e.g. meaningful & consistent names for values, hiding redundant variables in
   the flow condition, hiding unreachable expressions)

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

More information about the All-commits mailing list