[all-commits] [llvm/llvm-project] 9afc57: [CodeGen][UBSan] Handle sugared QualTypes correctl...

Usama Hameed via All-commits all-commits at lists.llvm.org
Wed Aug 16 14:48:17 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9afc57dcb2e5cd36ca1ddf0fee3efa958bfd4c2a
      https://github.com/llvm/llvm-project/commit/9afc57dcb2e5cd36ca1ddf0fee3efa958bfd4c2a
  Author: usama hameed <u_hameed at apple.com>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    M clang/lib/CodeGen/CodeGenFunction.cpp
    A clang/test/CodeGen/ubsan-function-attributed.c

  Log Message:
  -----------
  [CodeGen][UBSan] Handle sugared QualTypes correctly in
getUBSanFunctionTypeHash.

getUBSanFunctionTypeHash checks if a Type is a FunctionNoPrototype
by calling isa<FunctionNoProtoType>(). This does not work correctly when
the Type is wrapped in a sugar type such as an AttributedType. This
patch fixes this by using isFunctionNoProtoType() function which removes
sugar and returns the expected result.

The added test is a sanity check that the compiler no longer crashes
during compilation. It also compares the hash with and without the
function attribute for both FunctionNoProtoType and FunctionProtoType.
The hash remains the same for FunctionNoProtoType even with the addition
of an attribute.

rdar://113144087

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




More information about the All-commits mailing list