[llvm-commits] [llvm] r43089 - /llvm/trunk/include/llvm/ADT/StringMap.h

Ted Kremenek kremenek at apple.com
Wed Oct 17 14:13:50 PDT 2007


Author: kremenek
Date: Wed Oct 17 16:13:50 2007
New Revision: 43089

URL: http://llvm.org/viewvc/llvm-project?rev=43089&view=rev
Log:
Updated StringMap to use llvm::AlignOf to compute the alignment of map
entries.

Modified:
    llvm/trunk/include/llvm/ADT/StringMap.h

Modified: llvm/trunk/include/llvm/ADT/StringMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=43089&r1=43088&r2=43089&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/StringMap.h (original)
+++ llvm/trunk/include/llvm/ADT/StringMap.h Wed Oct 17 16:13:50 2007
@@ -141,15 +141,9 @@
     // in.  Allocate a new item with space for the string at the end and a null
     // terminator.
     unsigned AllocSize = sizeof(StringMapEntry)+KeyLength+1;
-    
-#ifdef __GNUC__
-    unsigned Alignment = __alignof__(StringMapEntry);
-#else
-    // FIXME: ugly.
-    unsigned Alignment = 8;
-#endif
-    StringMapEntry *NewItem = 
-      static_cast<StringMapEntry*>(Allocator.Allocate(AllocSize, Alignment));
+
+    StringMapEntry *NewItem = static_cast<StringMapEntry*>(
+        Allocator.Allocate(AllocSize, AlignOf<StringMapEntry>::Alignment));
     
     // Default construct the value.
     new (NewItem) StringMapEntry(KeyLength);





More information about the llvm-commits mailing list