[llvm] r225550 - Fix an ASAN failure introduced with r225537 (adding the -universal-headers to llvm-obdump).

Kevin Enderby enderby at apple.com
Fri Jan 9 13:55:04 PST 2015


Author: enderby
Date: Fri Jan  9 15:55:03 2015
New Revision: 225550

URL: http://llvm.org/viewvc/llvm-project?rev=225550&view=rev
Log:
Fix an ASAN failure introduced with r225537 (adding the -universal-headers to llvm-obdump).
And a fly by fix to some formatting issues with the same commit.

Modified:
    llvm/trunk/tools/llvm-objdump/MachODump.cpp

Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=225550&r1=225549&r2=225550&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Fri Jan  9 15:55:03 2015
@@ -475,12 +475,12 @@ static void printMachOUniversalHeaders(c
       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 Fil
     // 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();





More information about the llvm-commits mailing list