[lld] r369868 - [ELF] Delete a redundant dyn_cast<InputSection>. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 25 07:41:18 PDT 2019


Author: maskray
Date: Sun Aug 25 07:41:18 2019
New Revision: 369868

URL: http://llvm.org/viewvc/llvm-project?rev=369868&view=rev
Log:
[ELF] Delete a redundant dyn_cast<InputSection>. NFC

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=369868&r1=369867&r2=369868&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Sun Aug 25 07:41:18 2019
@@ -386,9 +386,11 @@ LinkerScript::computeInputSections(const
       // which are common because they are in the default bfd script.
       // We do not ignore SHT_REL[A] linker-synthesized sections here because
       // want to support scripts that do custom layout for them.
-      if (auto *isec = dyn_cast<InputSection>(sec))
-        if (isec->getRelocatedSection())
-          continue;
+      //
+      // It is safe to assume that Sec is an InputSection because mergeable or
+      // EH input sections have already been handled and eliminated.
+      if (cast<InputSection>(sec)->getRelocatedSection())
+        continue;
 
       std::string filename = getFilename(sec->file);
       if (!cmd->filePat.match(filename) ||
@@ -396,9 +398,6 @@ LinkerScript::computeInputSections(const
           !pat.sectionPat.match(sec->name))
         continue;
 
-      // It is safe to assume that Sec is an InputSection
-      // because mergeable or EH input sections have already been
-      // handled and eliminated.
       ret.push_back(cast<InputSection>(sec));
       sec->assigned = true;
     }




More information about the llvm-commits mailing list