[DWARF] - Simplify (use dyn_cast instead of isa + cast).
authorGeorge Rimar <grimar@accesssoftek.com>
Thu, 13 Apr 2017 09:52:50 +0000 (09:52 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Thu, 13 Apr 2017 09:52:50 +0000 (09:52 +0000)
This addresses post commit review comments for r300039.

llvm-svn: 300188

llvm/lib/DebugInfo/DWARF/DWARFContext.cpp

index ce5c4ae89e88317a85001e16e1b81a730f6f66a3..cbce2dc89debe6850b9a2186e5498d4e302d785d 100644 (file)
@@ -667,11 +667,11 @@ static Expected<uint64_t> getSymbolAddress(const object::ObjectFile &Obj,
 
 static bool isRelocScattered(const object::ObjectFile &Obj,
                              const RelocationRef &Reloc) {
-  if (!isa<MachOObjectFile>(&Obj))
+  const MachOObjectFile *MachObj = dyn_cast<MachOObjectFile>(&Obj);
+  if (!MachObj)
     return false;
   // MachO also has relocations that point to sections and
   // scattered relocations.
-  const MachOObjectFile *MachObj = cast<MachOObjectFile>(&Obj);
   auto RelocInfo = MachObj->getRelocation(Reloc.getRawDataRefImpl());
   return MachObj->isRelocationScattered(RelocInfo);
 }