[llvm] r183213 - [llvm-symbolizer] Avoid calling slow getSymbolSize for Mach-O files. Assume that symbols with zero size are in fact large enough.

Eric Christopher echristo at gmail.com
Tue Jun 4 10:20:51 PDT 2013


> -    if (error(si->getSize(SymbolSize)) || SymbolSize == UnknownAddressOrSize)
> +    // Getting symbol size is linear for Mach-O files, so avoid it.
> +    if (isa<MachOObjectFile>(Obj))
> +      SymbolSize = 0;
> +    else if (error(si->getSize(SymbolSize)) ||
> +             SymbolSize == UnknownAddressOrSize)

Expanding the comment here with the assumption that you're making
below would be good. Otherwise the code doesn't make a whole lot of
sense.

> +  // Assume that symbols with zero size are large enough.
> +  if (it->first.Addr < it->first.AddrEnd &&
> +      it->first.AddrEnd <= Address)
>      return false;
>    Name = it->second.str();
>    Addr = it->first.Addr;

-eric



More information about the llvm-commits mailing list