Skip to content

Conversation

@lanza
Copy link
Member

@lanza lanza commented Nov 22, 2025

Stack from ghstack (oldest at bottom):

Implements support for typeid expressions as l-values, matching traditional
CodeGen behavior. The typeid operator returns a const reference to std::type_info,
which requires creating an l-value from the RTTI descriptor.

Key changes:

  • CIRGenExprCXX: Add emitCXXTypeidExpr to emit GetGlobalOp for RTTI descriptors
  • CIRGenExpr: Add emitCXXTypeidLValue to create l-value from typeid expression
  • Refactored duplicate RTTI lookup code into helper lambda
  • Added comprehensive tests covering type operands, expression operands, and
    polymorphic types

Tests include CIR, LLVM (via CIR), and OGCG (Original CodeGen) output verification.

Note: Polymorphic typeid (vtable lookup) is not yet implemented and guarded with
llvm_unreachable.

[ghstack-poisoned]
lanza added a commit that referenced this pull request Nov 22, 2025
Implements support for typeid expressions as l-values, matching traditional
CodeGen behavior. The typeid operator returns a const reference to std::type_info,
which requires creating an l-value from the RTTI descriptor.

Key changes:
- CIRGenExprCXX: Add emitCXXTypeidExpr to emit GetGlobalOp for RTTI descriptors
- CIRGenExpr: Add emitCXXTypeidLValue to create l-value from typeid expression
- Refactored duplicate RTTI lookup code into helper lambda
- Added comprehensive tests covering type operands, expression operands, and
  polymorphic types

Tests include CIR, LLVM (via CIR), and OGCG (Original CodeGen) output verification.

Note: Polymorphic typeid (vtable lookup) is not yet implemented and guarded with
llvm_unreachable.


ghstack-source-id: be0adc5
Pull-Request: #2001
[ghstack-poisoned]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants