[PATCH] Driver: Replace switch cases with ifs.

Shankar Easwaran shankar.kalpathi.easwaran at gmail.com
Fri Feb 6 18:33:07 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.
----------------
Is it directive ? If so spell error.

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

================
Comment at: lib/Driver/WinLinkDriver.cpp:1160
@@ +1159,3 @@
+  for (auto *arg : parsedArgs->filtered(OPT_libpath))
+    ctx.appendInputSearchPath(ctx.allocate(arg->getValue()));
+
----------------
Why do you need to allocate the string ?

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

http://reviews.llvm.org/D7478

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






More information about the llvm-commits mailing list