[lld] r336354 - [ELF] - Convert excessive dyn_cast -> cast. NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 5 07:09:47 PDT 2018


Author: grimar
Date: Thu Jul  5 07:09:47 2018
New Revision: 336354

URL: http://llvm.org/viewvc/llvm-project?rev=336354&view=rev
Log:
[ELF] - Convert excessive dyn_cast -> cast. NFC.

Currently, there are only OutputSection and SymbolAssignment
commands possible at the first level under SECTIONS tag.

Hence, dyn_cast was excessive.

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=336354&r1=336353&r2=336354&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Jul  5 07:09:47 2018
@@ -248,13 +248,12 @@ void LinkerScript::declareSymbols() {
       declareSymbol(Cmd);
       continue;
     }
-    auto *Sec = dyn_cast<OutputSection>(Base);
-    if (!Sec)
-      continue;
+
     // If the output section directive has constraints,
     // we can't say for sure if it is going to be included or not.
     // Skip such sections for now. Improve the checks if we ever
     // need symbols from that sections to be declared early.
+    auto *Sec = cast<OutputSection>(Base);
     if (Sec->Constraint != ConstraintKind::NoConstraint)
       continue;
     for (BaseCommand *Base2 : Sec->SectionCommands)




More information about the llvm-commits mailing list