[PATCH] D144870: [Clang][DebugInfo] Emit zero size bitfields in the debug info to delimit bitfields in different allocation units.
Paul Robinson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 24 11:03:10 PDT 2023
probinson added a comment.
Still one question, and haven't dug into the test in detail yet.
================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:1552
+
+ auto *PreviousMDEntry =
+ PreviousFieldsDI.empty() ? nullptr : PreviousFieldsDI.back();
----------------
Maybe a comment here,
`// If we already emitted metadata for a 0-length bitfield, nothing to do here.`
(I was briefly confused by "if the previous field is a 0-length bitfield, do nothing" until I realized this is looking at the metadata not the decl.
================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:1563
+
+ assert(PreviousBitfield->isBitField());
+
----------------
Is this true for cases like
```
struct nonadjacent {
char a : 8;
char : 0;
int b;
char d : 8;
};
```
where the field `d` has a predecessor that is not a bitfield? (This might be my ignorance of how Decls are put together, but asserting that `advance` is guaranteed to get you a bitfield just seems a little odd.)
================
Comment at: clang/lib/CodeGen/CGDebugInfo.h:324
- /// Create new bit field member.
- llvm::DIType *createBitFieldType(const FieldDecl *BitFieldDecl,
- llvm::DIScope *RecordTy,
- const RecordDecl *RD);
+ /// Create new bit field member
+ llvm::DIDerivedType *createBitFieldType(const FieldDecl *BitFieldDecl,
----------------
Please keep that final `.`
================
Comment at: clang/lib/CodeGen/CGDebugInfo.h:330
+ /// Create an anonnymous zero-size separator for bit-field-decl if needed on
+ /// the target
+ llvm::DIDerivedType *createBitFieldSeparatorIfNeeded(
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144870/new/
https://reviews.llvm.org/D144870
More information about the cfe-commits
mailing list