[PATCH] D17256: [ELF] - Minor refactor of LinkerScript file.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 07:53:51 PST 2016


grimar added inline comments.

================
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())
----------------
rafael wrote:
> rafael wrote:
> > C is only used inside the if. Move the find call there?
> > 
> Actually. The if is on a repeated call to find. So just use 
> 
> auto C = Cmd.find(Tok);
> if (C != Cmd.end())
>   C->second(*this);
> 
> 
Yep, that what I wanted initially.


http://reviews.llvm.org/D17256





More information about the llvm-commits mailing list