[BPF] preserve btf_decl_tag for parameters of extern functions
authorEduard Zingerman <eddyz87@gmail.com>
Sat, 7 Jan 2023 06:45:09 +0000 (22:45 -0800)
committerYonghong Song <yhs@fb.com>
Sat, 7 Jan 2023 06:48:52 +0000 (22:48 -0800)
commit58bdf8f9a8c3331c6c4d5f631395fb6f786d1e9c
tree71c6299e948ab7c9846adcd895137cc1e610b652
parent5702202ad6662898d1b222a05e0a6e9d2efb428f
[BPF] preserve btf_decl_tag for parameters of extern functions

Generate DILocalVariable entries for parameters of extern functions,
the "annotations" field of DILocalVariable is used to link
"btf_decl_tag" annotation with the parameter.

Do this only for BPF backend as there are no other users for this
information. Final DWARF is valid as "Appendix A" is very much lax in
what is allowed as attributes for "DW_TAG_formal_parameter":

    DWARF does not in general require that a given debugging information
    entry contain a particular attribute or set of attributes. Instead,
    a DWARF producer is free to generate any, all, or none of the
    attributes ... other attributes ... may also appear in a given
    debugging information entry.

DWARF Debugging Information Format Version 5,
Appendix A: Attributes by Tag Value (Informative)
Page 251, Line 3.

Differential Revision: https://reviews.llvm.org/D140970
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGen/bpf-decl-tag-extern-func-args.c [new file with mode: 0644]