[PATCH] D111199: [Clang][LLVM][Attr] support btf_type_tag attribute
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 26 07:11:32 PDT 2021
aaron.ballman added reviewers: rsmith, dblaikie.
aaron.ballman added a comment.
Adding some additional reviewers who may have more opinions about the changes in CodeGen.
================
Comment at: clang/include/clang/Basic/AttrDocs.td:2029-2034
+Clang supports the ``__attribute__((btf_type_tag("ARGUMENT")))`` attribute for
+all targets. If -g is specified, for variable declaration type, function return
+type, function argument type, or typedef underlying type, if these types
+are pointer types, the ``ARGUMENT`` info will be preserved in IR and be emitted
+to dwarf. FOR BPF trgets, the ``ARGUMENT`` info will be eimitted to .BTF ELF
+section too.
----------------
================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:941-947
+ if (auto MTL = TL.getAs<MacroQualifiedTypeLoc>()) {
+ TL = MTL.getInnerLoc();
+ } else if (auto ATL = TL.getAs<AttributedTypeLoc>()) {
+ TL = ATL.getModifiedLoc();
+ } else {
+ break;
+ }
----------------
Phab's diff view is not helpful here -- removing the curly braces around single-line statements per our usual coding standards.
================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:1337
+ TypeLoc TL;
+ if (auto TSI = Ty->getDecl()->getTypeSourceInfo())
+ TL = TSI->getTypeLoc();
----------------
================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:1447-1448
+ TypeLoc ParamTL;
+ if (auto Param = FTL.getParam(Idx)) {
+ if (auto TSI = Param->getTypeSourceInfo())
+ ParamTL = TSI->getTypeLoc();
----------------
Can you spell out the types here?
================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:1646
+ TypeLoc TL;
+ if (auto TSI = field->getTypeSourceInfo())
+ TL = TSI->getTypeLoc();
----------------
================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:4061
+ if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
+ if (auto TSI = FD->getTypeSourceInfo())
+ TL = TSI->getTypeLoc();
----------------
================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:4468
+ TypeLoc TL;
+ if (auto TSI = VD->getTypeSourceInfo())
+ TL = TSI->getTypeLoc();
----------------
================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:5196
+ TypeLoc TL;
+ if (auto TSI = D->getTypeSourceInfo())
+ TL = TSI->getTypeLoc();
----------------
================
Comment at: clang/lib/Sema/SemaType.cpp:6526
+ }
+
+ ASTContext &Ctx = S.Context;
----------------
Should you also validate that the type is a pointer type?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111199/new/
https://reviews.llvm.org/D111199
More information about the cfe-commits
mailing list