OSDN Git Service

Don't use 'using std::error_code' in include/llvm.
[android-x86/external-llvm.git] / tools / llvm-readobj / ARMEHABIPrinter.h
index fae3b6d..716c9a1 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "Error.h"
 #include "StreamWriter.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/Object/ELF.h"
 #include "llvm/Object/ELFTypes.h"
 #include "llvm/Support/ARMEHABI.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/type_traits.h"
 
-namespace {
-template <typename type_, size_t N>
-size_t countof(const type_ (&)[N]) {
-  return N;
-}
-}
-
 namespace llvm {
+using std::error_code;
 namespace ARM {
 namespace EHABI {
 
@@ -296,7 +291,8 @@ void OpcodeDecoder::PrintRegisters(uint32_t VFPMask, StringRef Prefix) {
 void OpcodeDecoder::Decode(const uint8_t *Opcodes, off_t Offset, size_t Length) {
   for (unsigned OCI = Offset; OCI < Length + Offset; ) {
     bool Decoded = false;
-    for (unsigned REI = 0, REE = countof(Ring); REI != REE && !Decoded; ++REI) {
+    for (unsigned REI = 0, REE = array_lengthof(Ring);
+         REI != REE && !Decoded; ++REI) {
       if ((Opcodes[OCI ^ 3] & Ring[REI].Mask) == Ring[REI].Value) {
         (this->*Ring[REI].Routine)(Opcodes, OCI);
         Decoded = true;
@@ -376,7 +372,7 @@ PrinterContext<ET>::FindExceptionTable(unsigned IndexSectionIndex,
     if (SI->sh_type == ELF::SHT_REL && SI->sh_info == IndexSectionIndex) {
       for (Elf_Rel_iterator RI = ELF->begin_rel(&*SI), RE = ELF->end_rel(&*SI);
            RI != RE; ++RI) {
-        if (RI->r_offset == IndexTableOffset) {
+        if (RI->r_offset == static_cast<unsigned>(IndexTableOffset)) {
           typename object::ELFFile<ET>::Elf_Rela RelA;
           RelA.r_offset = RI->r_offset;
           RelA.r_info = RI->r_info;
@@ -390,7 +386,7 @@ PrinterContext<ET>::FindExceptionTable(unsigned IndexSectionIndex,
       }
     }
   }
-  return NULL;
+  return nullptr;
 }
 
 template <typename ET>
@@ -435,7 +431,7 @@ void PrinterContext<ET>::PrintExceptionTable(const Elf_Shdr *IT,
 
     switch (PersonalityIndex) {
     case AEABI_UNWIND_CPP_PR0:
-      llvm_unreachable("Personality 0 should be compact inline!");
+      PrintOpcodes(Contents->data() + TableEntryOffset, 3, 1);
       break;
     case AEABI_UNWIND_CPP_PR1:
     case AEABI_UNWIND_CPP_PR2: