[PATCH] D35169: Refactor DragonFly BSD toolchain driver.

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 06:49:12 PST 2019


mgorny added inline comments.
Herald added subscribers: jdoerfert, krytarowski.


================
Comment at: lib/Driver/ToolChains/DragonFly.cpp:118
     }
-    CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crti.o")));
-    if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))
-      CmdArgs.push_back(
-          Args.MakeArgString(getToolChain().GetFilePath("crtbeginS.o")));
+    if (crt1)
+      CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crt1)));
----------------
Can't `crt1` be non-null only if `!Args.hasArg(options::OPT_shared` here? i.e. is there a reason to do it like this instead of just pushing it inside the above `if`?


================
Comment at: lib/Driver/ToolChains/DragonFly.cpp:123
+
+    const char *crtbegin = nullptr;
+    if (Args.hasArg(options::OPT_shared) || IsPIE)
----------------
This default will never be used.


================
Comment at: lib/Driver/ToolChains/DragonFly.cpp:185
+    if (Args.hasArg(options::OPT_shared) || IsPIE)
+      CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtendS.o")));
     else
----------------
Inconsistency here: above you used helper variable, here you duplicate the whole line.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D35169/new/

https://reviews.llvm.org/D35169





More information about the cfe-commits mailing list