[PATCH] D17256: [ELF] - Minor refactor of LinkerScript file.
    Rafael Ávila de Espíndola via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Feb 18 07:42:34 PST 2016
    
    
  
rafael added a comment.
This is similar to how MC parser is done, so it is fine with me.
Rui, what do you think?
================
Comment at: ELF/LinkerScript.cpp:122
@@ -119,2 +121,3 @@
   bool IsUnderSysroot;
+  bool Error = false;
 };
----------------
Any particular  reason for this order? 
================
Comment at: ELF/LinkerScript.cpp:143
@@ -124,22 +142,3 @@
     StringRef Tok = next();
-    if (Tok == ";")
-      continue;
-    if (Tok == "ENTRY") {
-      readEntry();
-    } else if (Tok == "EXTERN") {
-      readExtern();
-    } else if (Tok == "GROUP" || Tok == "INPUT") {
-      readGroup();
-    } else if (Tok == "INCLUDE") {
-      readInclude();
-    } else if (Tok == "OUTPUT") {
-      readOutput();
-    } else if (Tok == "OUTPUT_ARCH") {
-      readOutputArch();
-    } else if (Tok == "OUTPUT_FORMAT") {
-      readOutputFormat();
-    } else if (Tok == "SEARCH_DIR") {
-      readSearchDir();
-    } else if (Tok == "SECTIONS") {
-      readSections();
-    } else {
+    auto C = Cmd.find(Tok);
+    if (Cmd.find(Tok) != Cmd.end())
----------------
C is only used inside the if. Move the find call there?
http://reviews.llvm.org/D17256
    
    
More information about the llvm-commits
mailing list