[all-commits] [llvm/llvm-project] e8a156: [clang][dataflow] Various changes to handling of m...

martinboehme via All-commits all-commits at lists.llvm.org
Sun Jul 9 23:46:13 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e8a1560d1de9514d3f1631388fe966476778e540
  Author: Martin Braenne <mboehme at google.com>
  Date:   2023-07-10 (Mon, 10 Jul 2023)

  Changed paths:
    M clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h
    M clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
    M clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp

  Log Message:
  [clang][dataflow] Various changes to handling of modeled fields.

- Rename `getReferencedFields()` to `getModeledFields()`. Move the logic that
  returns all object fields when doing a context-sensitive analysis to here from
  `DataflowAnalysisContext::createStorageLocation()`. I think all callers of
  the previous `getReferencedFields()` should use this logic; the fact that they
  were not doing so looks like a bug.

- Make `getModeledFields()` public. I have an upcoming patch that will need to
  use this function from Transfer.cpp, and there doesn't seem to be any reason
  why this function should not be public.

- Use a `SmallSetVector` to get deterministic iteration order. I have a pending
  patch where I'm getting flaky tests because
  `Environment::createValueUnlessSelfReferential()` is non-deterministically
  populating different fields depending on the iteration order. This change
  fixes those flaky tests.

Reviewed By: gribozavr2

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

  Commit: f653d14065a362c98114082c4e9a3b1ede7a90f5
  Author: Martin Braenne <mboehme at google.com>
  Date:   2023-07-10 (Mon, 10 Jul 2023)

  Changed paths:
    M clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp

  Log Message:
  [clang][dataflow] Various refactorings to UncheckedOptionalAccessModel.

These are intended to ease an upcoming change that will eliminate the duplication between `AggregateStorageLocation` and `StructValue` (see https://discourse.llvm.org/t/70086 for details), but many of the changes also have value in their own right.

Depends On D154586

Reviewed By: ymandel, gribozavr2

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

Compare: https://github.com/llvm/llvm-project/compare/712123e04d45...f653d14065a3

More information about the All-commits mailing list