Skip to content

[CIR] Upstream union support #136059

@andykaylor

Description

@andykaylor

Overview

Upstream support for union types. This will build on the existing record type support, but unions have special layout requirements and need extra handling during lowering to LLVM IR.

Suggested minimal test case

union U {
  int n;
  char c;
};

int f() {
  U u;
  return u.n;
}

Existing incubator tests

clang/test/CIR/CodeGen/union.cpp
clang/test/CIR/CodeGen/union-array.c
clang/test/CIR/CodeGen/union-init.c
clang/test/CIR/CodeGen/union-padding.c

Metadata

Metadata

Assignees

Labels

ClangIRAnything related to the ClangIR project

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions