[llvm-branch-commits] [llvm] b9e3a81 - Revert "[ADT] Simplify getFirstEl (NFC) (#153127)"

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Aug 12 07:38:20 PDT 2025


Author: Benjamin Chetioui
Date: 2025-08-12T16:38:16+02:00
New Revision: b9e3a814ee9387ab02640d7b34261830782ea598

URL: https://github.com/llvm/llvm-project/commit/b9e3a814ee9387ab02640d7b34261830782ea598
DIFF: https://github.com/llvm/llvm-project/commit/b9e3a814ee9387ab02640d7b34261830782ea598.diff

LOG: Revert "[ADT] Simplify getFirstEl (NFC) (#153127)"

This reverts commit 478aa0270915d9866bd3fe6fa2a4d156c6b473a8.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/SmallVector.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
index 6da519adcee6f..80f7734b86907 100644
--- a/llvm/include/llvm/ADT/SmallVector.h
+++ b/llvm/include/llvm/ADT/SmallVector.h
@@ -128,8 +128,8 @@ class SmallVectorTemplateCommon
   /// SmallVectorStorage is properly-aligned even for small-size of 0.
   void *getFirstEl() const {
     return const_cast<void *>(reinterpret_cast<const void *>(
-        reinterpret_cast<const SmallVectorAlignmentAndSize<T> *>(this)
-            ->FirstEl));
+        reinterpret_cast<const char *>(this) +
+        offsetof(SmallVectorAlignmentAndSize<T>, FirstEl)));
   }
   // Space after 'FirstEl' is clobbered, do not add any instance vars after it.
 


        


More information about the llvm-branch-commits mailing list