[all-commits] [llvm/llvm-project] 2bd8ae: [Clang] Fix unconditional access to Attr pointer w...

Shafik Yaghmour via All-commits all-commits at lists.llvm.org
Mon Jan 30 13:28:45 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2bd8aeea7e7d885fbf6c70c0e181b1e8e6b808a5
      https://github.com/llvm/llvm-project/commit/2bd8aeea7e7d885fbf6c70c0e181b1e8e6b808a5
  Author: Shafik Yaghmour <shafik.yaghmour at intel.com>
  Date:   2023-01-30 (Mon, 30 Jan 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/TreeTransform.h
    M clang/test/SemaCXX/nullability.cpp

  Log Message:
  -----------
  [Clang] Fix unconditional access to Attr pointer when checking if _Nullable is applicable to a type

In TransformAttributedType(...) when checking if _Nullable can be applied to a
type it dereferences TL.getAttr() unconditionally which we can see from the code
earlier in the function is not correct since it is expected to be nullptr in
some cases.

It looks like the correct course of action is to use TL.getModifiedLoc() over
TL.getAttr()->getLocation() in the case that TL.getAttr() returns a nullptr.

Fixes: https://github.com/llvm/llvm-project/issues/60344

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




More information about the All-commits mailing list