[lld] r281482 - Move helper function higher in the file. NFC
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 14 07:32:09 PDT 2016
Author: rafael
Date: Wed Sep 14 09:32:08 2016
New Revision: 281482
URL: http://llvm.org/viewvc/llvm-project?rev=281482&view=rev
Log:
Move helper function higher in the file. NFC
This just makes a followup patch easier to read.
Modified:
lld/trunk/ELF/LinkerScript.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=281482&r1=281481&r2=281482&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Sep 14 09:32:08 2016
@@ -110,24 +110,6 @@ static bool fileMatches(const InputSecti
!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<In
});
}
+// 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) {
More information about the llvm-commits
mailing list