[all-commits] [llvm/llvm-project] 211ca9: [CIR] DataMemberAttr: replace flat index with GEP-...

adams381 via All-commits all-commits at lists.llvm.org
Mon Jun 22 14:36:01 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 211ca98dd0a58600461f4d33ca5bf2a626558487
      https://github.com/llvm/llvm-project/commit/211ca98dd0a58600461f4d33ca5bf2a626558487
  Author: adams381 <adams at nvidia.com>
  Date:   2026-06-22 (Mon, 22 Jun 2026)

  Changed paths:
    M clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
    M clang/lib/CIR/CodeGen/CIRGenBuilder.h
    M clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
    M clang/lib/CIR/CodeGen/CIRGenModule.cpp
    M clang/lib/CIR/CodeGen/CIRGenModule.h
    M clang/lib/CIR/Dialect/IR/CIRAttrs.cpp
    M clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerItaniumCXXABI.cpp
    M clang/test/CIR/CodeGen/nonzeroinit-struct.cpp
    M clang/test/CIR/CodeGen/pointer-to-data-member.cpp
    M clang/test/CIR/IR/invalid-data-member.cir

  Log Message:
  -----------
  [CIR] DataMemberAttr: replace flat index with GEP-style path (#200854)

`DataMemberAttr` stored a single field index relative to the immediately containing class, which broke when the member is inherited: `int Derived::*p = &Derived::x` with `x` in Base produced a spurious `errorNYI` because Derived's CIR record doesn't directly hold `x`.

The attribute now stores a GEP-style `member_path` — a sequence of CIR field indices stepping from the pointer's class type down to the member, one level per inheritance hop. `lowerDataMemberConstant` walks the path accumulating element offsets to produce the Itanium ABI byte value.

`buildMemberPath` searches the `destClass` record tree for the target field (`findFieldMemberPath`). `CK_BaseToDerivedMemberPointer` and `CK_DerivedToBaseMemberPointer` return `{}` in ConstExprEmitter, delegating to the APValue path which builds the correct path via `buildMemberPath`. Virtual bases are not yet handled.

`CK_ReinterpretMemberPointer` remains `errorNYI` on this branch; a follow-up PR will add that separately.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list