[llvm-commits] [lld] r172338 - /lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp

Michael J. Spencer bigcheesegs at gmail.com
Sat Jan 12 17:09:39 PST 2013


Author: mspencer
Date: Sat Jan 12 19:09:39 2013
New Revision: 172338

URL: http://llvm.org/viewvc/llvm-project?rev=172338&view=rev
Log:
[YAML] Fix undefined behavior.

Modified:
    lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp

Modified: lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp?rev=172338&r1=172337&r2=172338&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp (original)
+++ lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp Sat Jan 12 19:09:39 2013
@@ -884,9 +884,11 @@
     virtual ContentPermissions permissions() const   { return _permissions; }
     virtual bool               isThumb() const       { return false; }
     virtual bool               isAlias() const       { return false; }
-    ArrayRef<uint8_t>          rawContent() const    { 
-                  return ArrayRef<uint8_t>((uint8_t*)&_content.operator[](0), 
-                                                      _content.size()); }
+    ArrayRef<uint8_t>          rawContent() const    {
+      return ArrayRef<uint8_t>(
+        reinterpret_cast<const uint8_t *>(_content.data()), _content.size());
+    }
+
     virtual uint64_t           ordinal() const       { return 0; }
     
     reference_iterator begin() const { 





More information about the llvm-commits mailing list