[clang] [llvm] Non constant size and offset in DWARF (PR #141106)

Tom Tromey via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 16 12:14:58 PDT 2025


================
@@ -834,8 +834,8 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
     auto *ISATy = DBuilder.createPointerType(ClassTy, Size);
 
     ObjTy = DBuilder.createStructType(TheCU, "objc_object", TheCU->getFile(), 0,
-                                      0, 0, llvm::DINode::FlagZero, nullptr,
-                                      llvm::DINodeArray());
+                                      (uint64_t)0, 0, llvm::DINode::FlagZero,
----------------
tromey wrote:

Good question.

I chose this approach because I wanted to leave open the possibility of `nullptr` here meaning "no offset" -- that was mentioned as being desirable functionality for Objective C in the Discourse thread (but whether it's implemented as `nullptr` is open of course).

One fix might be to reorder the arguments in the `Metadata*` case.

This only comes up for the maybe unusual case of creating a field whose offset is the constant `0`.  Any existing code like this should currently get a message about the ambiguity -- which is why I even inserted the casts here.

https://github.com/llvm/llvm-project/pull/141106


More information about the llvm-commits mailing list