Fix an ASAN failure introduced with r225537 (adding the -universal-headers to llvm...
authorKevin Enderby <enderby@apple.com>
Fri, 9 Jan 2015 21:55:03 +0000 (21:55 +0000)
committerKevin Enderby <enderby@apple.com>
Fri, 9 Jan 2015 21:55:03 +0000 (21:55 +0000)
And a fly by fix to some formatting issues with the same commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225550 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-objdump/MachODump.cpp

index 153edfab52c7072b5fb6d43a7776a06d95d5bd03..657f36247398d9872aeddd5b580c37d25f2c353a 100644 (file)
@@ -475,12 +475,12 @@ static void printMachOUniversalHeaders(const object::MachOUniversalBinary *UB,
       MachOUniversalBinary::ObjectForArch other_OFA(UB, j);
       uint32_t other_cputype = other_OFA.getCPUType();
       uint32_t other_cpusubtype = other_OFA.getCPUSubType();
-      if (cputype != 0 && cpusubtype != 0 &&
-          cputype == other_cputype &&
+      if (cputype != 0 && cpusubtype != 0 && cputype == other_cputype &&
           (cpusubtype & ~MachO::CPU_SUBTYPE_MASK) ==
-          (other_cpusubtype & ~MachO::CPU_SUBTYPE_MASK))
+              (other_cpusubtype & ~MachO::CPU_SUBTYPE_MASK)) {
         outs() << "(illegal duplicate architecture) ";
         break;
+      }
     }
     if (verbose) {
       outs() << OFA.getArchTypeName() << "\n";
@@ -611,11 +611,11 @@ void llvm::ParseInputMachO(StringRef Filename) {
     // No architecture flags were specified so if this contains a slice that
     // matches the host architecture dump only that.
     if (!ArchAll) {
-      StringRef HostArchName = MachOObjectFile::getHostArch().getArchName();
       for (MachOUniversalBinary::object_iterator I = UB->begin_objects(),
                                                  E = UB->end_objects();
            I != E; ++I) {
-        if (HostArchName == I->getArchTypeName()) {
+        if (MachOObjectFile::getHostArch().getArchName() ==
+            I->getArchTypeName()) {
           ErrorOr<std::unique_ptr<ObjectFile>> ObjOrErr = I->getAsObjectFile();
           std::string ArchiveName;
           ArchiveName.clear();