[PATCH] Driver: Replace switch cases with ifs.

Rui Ueyama ruiu at google.com
Fri Feb 6 18:44:03 PST 2015


================
Comment at: lib/Driver/WinLinkDriver.cpp:1116
@@ +1115,3 @@
+    // case. It's odd that the command line option has different semantics in
+    // the .drectve section, but this behavior is needed for compatibility
+    // with MSVC's link.exe.
----------------
shankar.easwaran wrote:
> Is it directive ? If so spell error.
This spelling is correct. It's a section name.

================
Comment at: lib/Driver/WinLinkDriver.cpp:1125
@@ +1124,3 @@
+    llvm::BumpPtrAllocator alloc;
+    std::vector<moduledef::Directive *> dirs;
+    if (!parseDef(arg->getValue(), alloc, dirs)) {
----------------
shankar.easwaran wrote:
> BumpPtrAllocator will be destructed as soon it is out of scope ?
I believe this is correct. This is not new code at least.

================
Comment at: lib/Driver/WinLinkDriver.cpp:1160
@@ +1159,3 @@
+  for (auto *arg : parsedArgs->filtered(OPT_libpath))
+    ctx.appendInputSearchPath(ctx.allocate(arg->getValue()));
+
----------------
shankar.easwaran wrote:
> Why do you need to allocate the string ?
This is not new code. Basically everything is mechanical translation from the original.

================
Comment at: lib/Driver/WinLinkDriver.cpp:1164
@@ +1163,3 @@
+    StringRef val = arg->getValue();
+    if (val.equals_lower("noref")) {
+      ctx.setDeadStripping(false);
----------------
shankar.easwaran wrote:
> If you lower case the argument value in the variable val, the code would become more readable.
Done.

http://reviews.llvm.org/D7478

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list