forked from OSchip/llvm-project
Move helper function higher in the file. NFC
This just makes a followup patch easier to read. llvm-svn: 281482
This commit is contained in:
parent
ec2d206669
commit
be94e1b630
|
@ -110,24 +110,6 @@ static bool fileMatches(const InputSectionDescription *Desc,
|
|||
!const_cast<Regex &>(Desc->ExcludedFileRe).match(Filename);
|
||||
}
|
||||
|
||||
// Returns input sections filtered by given glob patterns.
|
||||
template <class ELFT>
|
||||
std::vector<InputSectionBase<ELFT> *>
|
||||
LinkerScript<ELFT>::getInputSections(const InputSectionDescription *I) {
|
||||
const Regex &Re = I->SectionRe;
|
||||
std::vector<InputSectionBase<ELFT> *> Ret;
|
||||
for (ObjectFile<ELFT> *F : Symtab<ELFT>::X->getObjectFiles())
|
||||
if (fileMatches(I, sys::path::filename(F->getName())))
|
||||
for (InputSectionBase<ELFT> *S : F->getSections())
|
||||
if (!isDiscarded(S) && !S->OutSec &&
|
||||
const_cast<Regex &>(Re).match(S->Name))
|
||||
Ret.push_back(S);
|
||||
|
||||
if (const_cast<Regex &>(Re).match("COMMON"))
|
||||
Ret.push_back(CommonInputSection<ELFT>::X);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
static bool compareName(InputSectionData *A, InputSectionData *B) {
|
||||
return A->Name < B->Name;
|
||||
}
|
||||
|
@ -146,14 +128,6 @@ getComparator(SortKind K) {
|
|||
return compareAlignment;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
void LinkerScript<ELFT>::discard(ArrayRef<InputSectionBase<ELFT> *> V) {
|
||||
for (InputSectionBase<ELFT> *S : V) {
|
||||
S->Live = false;
|
||||
reportDiscarded(S);
|
||||
}
|
||||
}
|
||||
|
||||
static bool checkConstraint(uint64_t Flags, ConstraintKind Kind) {
|
||||
bool RO = (Kind == ConstraintKind::ReadOnly);
|
||||
bool RW = (Kind == ConstraintKind::ReadWrite);
|
||||
|
@ -171,6 +145,32 @@ static bool matchConstraints(ArrayRef<InputSectionBase<ELFT> *> Sections,
|
|||
});
|
||||
}
|
||||
|
||||
// Returns input sections filtered by given glob patterns.
|
||||
template <class ELFT>
|
||||
std::vector<InputSectionBase<ELFT> *>
|
||||
LinkerScript<ELFT>::getInputSections(const InputSectionDescription *I) {
|
||||
const Regex &Re = I->SectionRe;
|
||||
std::vector<InputSectionBase<ELFT> *> Ret;
|
||||
for (ObjectFile<ELFT> *F : Symtab<ELFT>::X->getObjectFiles())
|
||||
if (fileMatches(I, sys::path::filename(F->getName())))
|
||||
for (InputSectionBase<ELFT> *S : F->getSections())
|
||||
if (!isDiscarded(S) && !S->OutSec &&
|
||||
const_cast<Regex &>(Re).match(S->Name))
|
||||
Ret.push_back(S);
|
||||
|
||||
if (const_cast<Regex &>(Re).match("COMMON"))
|
||||
Ret.push_back(CommonInputSection<ELFT>::X);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
void LinkerScript<ELFT>::discard(ArrayRef<InputSectionBase<ELFT> *> V) {
|
||||
for (InputSectionBase<ELFT> *S : V) {
|
||||
S->Live = false;
|
||||
reportDiscarded(S);
|
||||
}
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::vector<InputSectionBase<ELFT> *>
|
||||
LinkerScript<ELFT>::createInputSectionList(OutputSectionCommand &OutCmd) {
|
||||
|
|
Loading…
Reference in New Issue