}
static std::vector<StringRef> getLines(MemoryBufferRef MB) {
- std::vector<StringRef> Ret;
SmallVector<StringRef, 0> Arr;
MB.getBuffer().split(Arr, '\n');
+
+ std::vector<StringRef> Ret;
for (StringRef S : Arr) {
S = S.trim();
if (!S.empty())
Config->SymbolOrderingFile.insert({S, I++});
}
-// Parse the --retain-symbols-file argument. File has form:
-// symbolName1
-// [...]
-// symbolNameN
-static void parseRetainSymbolsList(MemoryBufferRef MB) {
- for (StringRef S : getLines(MB))
- Config->RetainSymbolsFile.insert(S);
-}
-
// Initializes Config members by the command line options.
void LinkerDriver::readConfigs(opt::InputArgList &Args) {
for (auto *Arg : Args.filtered(OPT_L))
if (auto *Arg = Args.getLastArg(OPT_retain_symbols_file)) {
Config->Discard = DiscardPolicy::RetainFile;
if (Optional<MemoryBufferRef> Buffer = readFile(Arg->getValue()))
- parseRetainSymbolsList(*Buffer);
+ for (StringRef S : getLines(*Buffer))
+ Config->RetainSymbolsFile.insert(S);
}
for (auto *Arg : Args.filtered(OPT_export_dynamic_symbol))