[PATCH] D35987: [ELF] - Introduce std::vector<InputFile *> global arrays.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 31 22:59:46 PDT 2017
>> ===================================================================
>> --- ELF/SyntheticSections.cpp
>> +++ ELF/SyntheticSections.cpp
>> @@ -1027,9 +1027,10 @@
>> if (!Config->Rpath.empty())
>> add({Config->EnableNewDtags ? DT_RUNPATH : DT_RPATH,
>> InX::DynStrTab->addString(Config->Rpath)});
>> - for (SharedFile<ELFT> *F : SharedFile<ELFT>::Instances)
>> - if (F->isNeeded())
>> - add({DT_NEEDED, InX::DynStrTab->addString(F->SoName)});
>> + for (InputFile *File : SharedFiles)
>> + if (SharedFile<ELFT> *F = cast<SharedFile<ELFT>>(File))
>
>You don't need an 'if' if you are using a cast.
Yes, I know. `if` here was placed to reduce amount of code.
Otherwise it would be a bit longer:
for (InputFile *F : SharedFiles) {
SharedFile<ELFT> *F = cast<SharedFile<ELFT>>(F);
...
}
I was unsure if I should use such a hack. Looks it was not good idea.
>This seems reasonable. I will take a look at the dependencies to have a
>better idea.
>
Cheers,
>Rafael
George.
More information about the llvm-commits
mailing list