[PATCH] D35936: [ELF] - Move getSymbols() method to InputFile.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 31 17:50:11 PDT 2017


George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> Index: ELF/InputSection.cpp
> ===================================================================
> --- ELF/InputSection.cpp
> +++ ELF/InputSection.cpp
> @@ -227,7 +227,7 @@
>      SrcFile = toString(File);
>  
>    // Find a function symbol that encloses a given location.
> -  for (SymbolBody *B : getFile<ELFT>()->getSymbols())
> +  for (SymbolBody *B : getFile<ELFT>()->getObjSymbols())

I think you can just use File instead of getFile<ELFT>() now.

>      if (auto *D = dyn_cast<DefinedRegular>(B))
>        if (D->Section == this && D->Type == STT_FUNC)
>          if (D->Value <= Offset && Offset < D->Value + D->Size)
> @@ -285,7 +285,7 @@
>      Archive = (" in archive " + File->ArchiveName).str();
>  
>    // Find a symbol that encloses a given location.
> -  for (SymbolBody *B : getFile<ELFT>()->getSymbols())
> +  for (SymbolBody *B : getFile<ELFT>()->getObjSymbols())

Same in here.

Why is it necessary to rename getSymbols to getObjSymbols?

There are many getSymbols in the various InputFiles. With the exception
of the one in lazyObjectFile, can you merge them all? They currently
return ArrayRef<Symbol *>, but can probably be changed to return
ArrayRef<SymbolBody *>.

Cheers,
Rafael


More information about the llvm-commits mailing list