[all-commits] [llvm/llvm-project] db898d: [clang][dataflow] Refactor `TestingSupport.h`

weiyi via All-commits all-commits at lists.llvm.org
Thu Sep 1 06:22:38 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: db898d43b08e13f5c1fda92b8341cd1709f5af21
      https://github.com/llvm/llvm-project/commit/db898d43b08e13f5c1fda92b8341cd1709f5af21
  Author: Wei Yi Tee <wyt at google.com>
  Date:   2022-09-01 (Thu, 01 Sep 2022)

  Changed paths:
    M clang/unittests/Analysis/FlowSensitive/TestingSupport.cpp
    M clang/unittests/Analysis/FlowSensitive/TestingSupport.h
    M clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp

  Log Message:
  -----------
  [clang][dataflow] Refactor `TestingSupport.h`

- Add `AnalysisInputs` struct as the parameters for `checkDataflow`, and renamed `AnalysisData` struct to `AnalysisOutputs` which contains the data structures generated from a dataflow analysis run.

- Remove compulsory binding from statement to annotations. Instead, `checkDataflow` in the most general form takes a `VerifyResults` callback which takes as input an `AnalysisOutputs` struct. This struct contains the data structures generated by the analysis that can then be tested. We then introduce two overloads/wrappers of `checkDataflow` for different mechanisms of testing - one which exposes annotation line numbers and is not restricted to statements, and the other which exposes states computed after annotated statements. In the future, we should look at retrieving the analysis states for constructs other than statements.

Reviewed By: gribozavr2, sgatev

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




More information about the All-commits mailing list