This is an archive of the discontinued LLVM Phabricator instance.

[clang] Implement constexpr operator[] for vectors
Needs ReviewPublic

Authored by DaPorkchop_ on Aug 16 2023, 1:01 AM.

Details

Summary

This implements the array subscript operator for vector types.

As vectors don't decay into pointers, I've opted to evaluate the vector
operand as an LValue, which still gives the expected behavior.

Diff Detail

Event Timeline

DaPorkchop_ created this revision.Aug 16 2023, 1:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2023, 1:01 AM
DaPorkchop_ requested review of this revision.Aug 16 2023, 1:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2023, 1:01 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Fixed test code for CodeGenCXX/temporaries.cpp

Creating and extracting a reference to a temporary
vector's element is now able to be evaluated at compile
time, which made this test case fail (since it was looking
for code which no longer needs to be generated).