[lld] r315394 - Remove a constructor from ExprValue. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 17:06:27 PDT 2017


Author: ruiu
Date: Tue Oct 10 17:06:27 2017
New Revision: 315394

URL: http://llvm.org/viewvc/llvm-project?rev=315394&view=rev
Log:
Remove a constructor from ExprValue. NFC.

I think three ctors are too many for this simple class.

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

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=315394&r1=315393&r2=315394&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue Oct 10 17:06:27 2017
@@ -859,16 +859,16 @@ bool LinkerScript::needsInterpSection()
 ExprValue LinkerScript::getSymbolValue(const Twine &Loc, StringRef S) {
   if (S == ".") {
     if (CurAddressState)
-      return {CurAddressState->OutSec, Dot - CurAddressState->OutSec->Addr,
-              Loc};
+      return {CurAddressState->OutSec, false,
+              Dot - CurAddressState->OutSec->Addr, Loc};
     error(Loc + ": unable to get location counter value");
     return 0;
   }
   if (SymbolBody *B = Symtab->find(S)) {
     if (auto *D = dyn_cast<DefinedRegular>(B))
-      return {D->Section, D->Value, Loc};
+      return {D->Section, false, D->Value, Loc};
     if (auto *C = dyn_cast<DefinedCommon>(B))
-      return {C->Section, 0, Loc};
+      return {C->Section, false, 0, Loc};
   }
   error(Loc + ": symbol not found: " + S);
   return 0;

Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=315394&r1=315393&r2=315394&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Tue Oct 10 17:06:27 2017
@@ -43,9 +43,6 @@ struct ExprValue {
             const Twine &Loc)
       : Sec(Sec), ForceAbsolute(ForceAbsolute), Val(Val), Loc(Loc.str()) {}
 
-  ExprValue(SectionBase *Sec, uint64_t Val, const Twine &Loc)
-      : ExprValue(Sec, false, Val, Loc) {}
-
   ExprValue(uint64_t Val) : ExprValue(nullptr, false, Val, "") {}
 
   bool isAbsolute() const { return ForceAbsolute || Sec == nullptr; }

Modified: lld/trunk/ELF/ScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=315394&r1=315393&r2=315394&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.cpp (original)
+++ lld/trunk/ELF/ScriptParser.cpp Tue Oct 10 17:06:27 2017
@@ -150,7 +150,7 @@ static ExprValue add(ExprValue A, ExprVa
 }
 
 static ExprValue sub(ExprValue A, ExprValue B) {
-  return {A.Sec, A.getSectionOffset() - B.getValue(), A.Loc};
+  return {A.Sec, false, A.getSectionOffset() - B.getValue(), A.Loc};
 }
 
 static ExprValue mul(ExprValue A, ExprValue B) {
@@ -945,10 +945,10 @@ Expr ScriptParser::readPrimary() {
   }
   if (Tok == "ADDR") {
     StringRef Name = readParenLiteral();
-    OutputSection *Cmd = Script->getOrCreateOutputSection(Name);
+    OutputSection *Sec = Script->getOrCreateOutputSection(Name);
     return [=]() -> ExprValue {
-      checkIfExists(Cmd, Location);
-      return {Cmd, 0, Location};
+      checkIfExists(Sec, Location);
+      return {Sec, false, 0, Location};
     };
   }
   if (Tok == "ALIGN") {




More information about the llvm-commits mailing list