HomePhabricator

[analyzer] Fix region cast between the same types with different qualifiers.

Authored by ASDenysPetrov on Nov 9 2021, 4:20 AM.

Description

[analyzer] Fix region cast between the same types with different qualifiers.

Summary: Specifically, this fixes the case when we get an access to array element through the pointer to element. This covers several FIXME's. in https://reviews.llvm.org/D111654.
Example:

const int arr[4][2];
const int *ptr = arr[1]; // Fixes this.

The issue is that arr[1] is int* (&Element{Element{glob_arr5,1 S64b,int[2]},0 S64b,int}), and ptr is const int*. We don't take qualifiers into account. Consequently, we doesn't match the types as the same ones.

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