[PATCH] D28669: [ARM] Remove ubig32_t cast from ARMAttributeParser

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 13 04:14:49 PST 2017


samparker updated this revision to Diff 84278.
samparker added a comment.

Re-adding ubig32_t, but now using if/else to select the cast.


https://reviews.llvm.org/D28669

Files:
  lib/Support/ARMAttributeParser.cpp


Index: lib/Support/ARMAttributeParser.cpp
===================================================================
--- lib/Support/ARMAttributeParser.cpp
+++ lib/Support/ARMAttributeParser.cpp
@@ -685,9 +685,13 @@
   unsigned SectionNumber = 0;
 
   while (Offset < Section.size()) {
-    uint32_t SectionLength = isLittle ?
-      *reinterpret_cast<const support::ulittle32_t*>(Section.data() + Offset) :
-      *reinterpret_cast<const support::ubig32_t*>(Section.data() + Offset);
+    uint32_t SectionLength = 0;
+    if (isLittle)
+      SectionLength =
+        *reinterpret_cast<const support::ulittle32_t*>(Section.data() + Offset);
+    else
+      SectionLength =
+        *reinterpret_cast<const support::ubig32_t*>(Section.data() + Offset);
 
     if (SW) {
       SW->startLine() << "Section " << ++SectionNumber << " {\n";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28669.84278.patch
Type: text/x-patch
Size: 831 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170113/19b39d78/attachment.bin>


More information about the llvm-commits mailing list