[all-commits] [llvm/llvm-project] 3466e0: Reland "[Attr] support btf_type_tag attribute"

yonghong-song via All-commits all-commits at lists.llvm.org
Fri Nov 5 11:26:13 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3466e00716e12e32fdb100e3fcfca5c2b3e8d784
      https://github.com/llvm/llvm-project/commit/3466e00716e12e32fdb100e3fcfca5c2b3e8d784
  Author: Yonghong Song <yhs at fb.com>
  Date:   2021-11-05 (Fri, 05 Nov 2021)

  Changed paths:
    M clang/lib/CodeGen/CGDebugInfo.cpp
    M clang/lib/CodeGen/CGDebugInfo.h
    A clang/test/CodeGen/attr-btf_type_tag-func.c
    A clang/test/CodeGen/attr-btf_type_tag-typedef-field.c
    A clang/test/CodeGen/attr-btf_type_tag-var.c
    M llvm/include/llvm/IR/DIBuilder.h
    M llvm/lib/IR/DIBuilder.cpp
    A llvm/test/Bitcode/attr-btf_type_tag.ll
    A llvm/test/DebugInfo/attr-btf_type_tag.ll

  Log Message:
  -----------
  Reland "[Attr] support btf_type_tag attribute"

This is to revert commit f95bd18b5faa (Revert "[Attr] support
btf_type_tag attribute") plus a bug fix.

Previous change failed to handle cases like below:
    $ cat reduced.c
    void a(*);
    void a() {}
    $ clang -c reduced.c -O2 -g

In such cases, during clang IR generation, for function a(),
CGCodeGen has numParams = 1 for FunctionType. But for
FunctionTypeLoc we have FuncTypeLoc.NumParams = 0. By using
FunctionType.numParams as the bound to access FuncTypeLoc
params, a random crash is triggered. The bug fix is to
check against FuncTypeLoc.NumParams before accessing
FuncTypeLoc.getParam(Idx).

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




More information about the All-commits mailing list