[lld] r297850 - [ELF] - Linkerscript: make Dot public and remove getDot(). NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 09:07:02 PDT 2017


Author: grimar
Date: Wed Mar 15 11:07:02 2017
New Revision: 297850

URL: http://llvm.org/viewvc/llvm-project?rev=297850&view=rev
Log:
[ELF] - Linkerscript: make Dot public and remove getDot(). NFC.

Suggested by Rui Ueyama,
also groups member variables in a single place, while I am here.

Modified:
    lld/trunk/ELF/LinkerScript.cpp
    lld/trunk/ELF/LinkerScript.h

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=297850&r1=297849&r2=297850&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Mar 15 11:07:02 2017
@@ -1424,7 +1424,7 @@ Expr ScriptParser::readAssert() {
   return [=] {
     if (!E())
       error(Msg);
-    return ScriptBase->getDot();
+    return ScriptBase->Dot;
   };
 }
 
@@ -1754,7 +1754,7 @@ Expr ScriptParser::readPrimary() {
       return [=] { return alignTo(E(), E2()); };
     }
     expect(")");
-    return [=] { return alignTo(ScriptBase->getDot(), E()); };
+    return [=] { return alignTo(ScriptBase->Dot, E()); };
   }
   if (Tok == "CONSTANT") {
     StringRef Name = readParenLiteral();
@@ -1778,13 +1778,13 @@ Expr ScriptParser::readPrimary() {
     expect(",");
     readExpr();
     expect(")");
-    return [=] { return alignTo(ScriptBase->getDot(), E()); };
+    return [=] { return alignTo(ScriptBase->Dot, E()); };
   }
   if (Tok == "DATA_SEGMENT_END") {
     expect("(");
     expect(".");
     expect(")");
-    return []() { return ScriptBase->getDot(); };
+    return []() { return ScriptBase->Dot; };
   }
   // GNU linkers implements more complicated logic to handle
   // DATA_SEGMENT_RELRO_END. We instead ignore the arguments and just align to
@@ -1795,7 +1795,7 @@ Expr ScriptParser::readPrimary() {
     expect(",");
     readExpr();
     expect(")");
-    return []() { return alignTo(ScriptBase->getDot(), Target->PageSize); };
+    return []() { return alignTo(ScriptBase->Dot, Target->PageSize); };
   }
   if (Tok == "SIZEOF") {
     StringRef Name = readParenLiteral();

Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=297850&r1=297849&r2=297850&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Wed Mar 15 11:07:02 2017
@@ -252,7 +252,6 @@ protected:
   // "ScriptConfig" is a bit too long, so define a short name for it.
   ScriptConfiguration &Opt = *ScriptConfig;
 
-  uint64_t Dot;
   uint64_t ThreadBssOffset = 0;
 
   std::function<uint64_t()> LMAOffset;
@@ -263,8 +262,10 @@ protected:
   llvm::DenseSet<InputSectionBase *> AlreadyOutputIS;
 
 public:
+  uint64_t Dot;
+  std::vector<OutputSection *> *OutputSections;
+
   bool hasPhdrsCommands() { return !Opt.PhdrsCommands.empty(); }
-  uint64_t getDot() { return Dot; }
   OutputSection *getOutputSection(const Twine &Loc, StringRef S);
   uint64_t getOutputSectionSize(StringRef S);
   void discard(ArrayRef<InputSectionBase *> V);
@@ -274,7 +275,6 @@ public:
   virtual bool isAbsolute(StringRef S) = 0;
   virtual OutputSection *getSymbolSection(StringRef S) = 0;
 
-  std::vector<OutputSection *> *OutputSections;
   void addOrphanSections(OutputSectionFactory &Factory);
   void removeEmptyCommands();
   void adjustSectionsBeforeSorting();




More information about the llvm-commits mailing list