Skip to content

Commit 6f3b360

Browse files
authored
Revert "[ADT] Simplify getFirstEl (NFC)" (#153201)
Reverts #153127 This broke ubsan: https://lab.llvm.org/buildbot/#/builders/25/builds/10649.
1 parent f8653ce commit 6f3b360

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/include/llvm/ADT/SmallVector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ class SmallVectorTemplateCommon
128128
/// SmallVectorStorage is properly-aligned even for small-size of 0.
129129
void *getFirstEl() const {
130130
return const_cast<void *>(reinterpret_cast<const void *>(
131-
reinterpret_cast<const SmallVectorAlignmentAndSize<T> *>(this)
132-
->FirstEl));
131+
reinterpret_cast<const char *>(this) +
132+
offsetof(SmallVectorAlignmentAndSize<T>, FirstEl)));
133133
}
134134
// Space after 'FirstEl' is clobbered, do not add any instance vars after it.
135135

0 commit comments

Comments
 (0)