[all-commits] [llvm/llvm-project] 155fca: [clang] Fix noderef for array member of deref ...

Leonard Chan via All-commits all-commits at lists.llvm.org
Mon Dec 7 14:40:15 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 155fca3cae275562e626d3e4fbfac70b4b75d2e7
      https://github.com/llvm/llvm-project/commit/155fca3cae275562e626d3e4fbfac70b4b75d2e7
  Author: Leonard Chan <leonardchan at google.com>
  Date:   2020-12-07 (Mon, 07 Dec 2020)

  Changed paths:
    M clang/lib/Sema/SemaExprMember.cpp
    M clang/test/Frontend/noderef.c

  Log Message:
  -----------
      [clang] Fix noderef for array member of deref expr

    Committing on behalf of thejh (Jann Horn).

    Given an attribute((noderef)) pointer "p" to the struct

    struct s { int a[2]; };
    ensure that the following expressions are treated the same way by the
    noderef logic:

    p->a
    (*p).a
    Until now, the first expression would be treated correctly (nothing is
    added to PossibleDerefs because CheckMemberAccessOfNoDeref() bails out
    on array members), but the second expression would incorrectly warn
    because "*p" creates a PossibleDerefs entry.

    Handle this case the same way as for the AddrOf operator.

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




More information about the All-commits mailing list