Subzero: Misc fixes/cleanup.

1. Fix MINIMAL build.
  (a) Add a void cast to a var only used in asserts.
  (b) Use "REQUIRES:" instead of "REQUIRES" in a .ll file.
2. Use StrError instead of StrDump for errors.
3. Use a lambda instead of a functor because C++11.
4. Explicit check for -filetype=obj in a non-dump-enabled build, to avoid cryptic downstream error messages.
5. Run "make format" which was neglected earlier.

BUG= none
R=kschimpf@google.com

Review URL: https://codereview.chromium.org/1284493003.
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index 462cbcb..76dc097 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -671,6 +671,7 @@
       [](const LiveBeginEndMapEntry &A, const LiveBeginEndMapEntry &B) {
         return A.first == B.first;
       };
+  (void)ComparePair;
   assert(std::adjacent_find(MapBegin.begin(), MapBegin.end(), ComparePair) ==
          MapBegin.end());
   assert(std::adjacent_find(MapEnd.begin(), MapEnd.end(), ComparePair) ==
diff --git a/src/IceCompiler.cpp b/src/IceCompiler.cpp
index 23733ce..e4d9b1c 100644
--- a/src/IceCompiler.cpp
+++ b/src/IceCompiler.cpp
@@ -93,8 +93,19 @@
     return Ctx.getErrorStatus()->assign(EC_None);
 
   if (!BuildDefs::disableIrGen() && Ctx.getFlags().getDisableIRGeneration()) {
-    Ctx.getStrDump() << "Error: Build doesn't allow --no-ir-gen when not "
-                     << "ALLOW_DISABLE_IR_GEN!\n";
+    Ctx.getStrError() << "Error: Build doesn't allow --no-ir-gen when not "
+                      << "ALLOW_DISABLE_IR_GEN!\n";
+    return Ctx.getErrorStatus()->assign(EC_Args);
+  }
+
+  // The Minimal build (specifically, when dump()/emit() are not implemented)
+  // allows only --filetype=obj.  Check here to avoid cryptic error messages
+  // downstream.
+  if (!BuildDefs::dump() && Ctx.getFlags().getOutFileType() != FT_Elf) {
+    // TODO(stichnot): Access the actual command-line argument via
+    // llvm::Option.ArgStr and .ValueStr .
+    Ctx.getStrError()
+        << "Error: only --filetype=obj is supported in this build.\n";
     return Ctx.getErrorStatus()->assign(EC_Args);
   }
 
@@ -121,7 +132,7 @@
     Translator.reset(PTranslator.release());
   } else if (BuildDefs::llvmIr()) {
     if (PNACL_BROWSER_TRANSLATOR) {
-      Ctx.getStrDump()
+      Ctx.getStrError()
           << "non BuildOnRead is not supported w/ PNACL_BROWSER_TRANSLATOR\n";
       return Ctx.getErrorStatus()->assign(EC_Args);
     }
@@ -142,8 +153,8 @@
     Converter->convertToIce();
     Translator.reset(Converter.release());
   } else {
-    Ctx.getStrDump() << "Error: Build doesn't allow LLVM IR, "
-                     << "--build-on-read=0 not allowed\n";
+    Ctx.getStrError() << "Error: Build doesn't allow LLVM IR, "
+                      << "--build-on-read=0 not allowed\n";
     return Ctx.getErrorStatus()->assign(EC_Args);
   }
 
diff --git a/src/IceInstARM32.cpp b/src/IceInstARM32.cpp
index 15664f7..add4df0 100644
--- a/src/IceInstARM32.cpp
+++ b/src/IceInstARM32.cpp
@@ -479,7 +479,7 @@
   Ostream &Str = Func->getContext()->getStrEmit();
   assert(getSrcSize() == 1);
   assert(getDest()->hasReg());
-  Str << "\t"<< Opcode << getPredicate() << "\t";
+  Str << "\t" << Opcode << getPredicate() << "\t";
   getDest()->emit(Func);
   Str << ", ";
   getSrc(0)->emit(Func);
@@ -649,7 +649,7 @@
   assert(getSrcSize() == 1);
   assert(getDest()->hasReg());
   Type Ty = getSrc(0)->getType();
-  Str << "\t"<< Opcode << getWidthString(Ty) << getPredicate() << "\t";
+  Str << "\t" << Opcode << getWidthString(Ty) << getPredicate() << "\t";
   getDest()->emit(Func);
   Str << ", ";
   getSrc(0)->emit(Func);
diff --git a/src/IceRegAlloc.cpp b/src/IceRegAlloc.cpp
index d0dc3fb..0d9afba 100644
--- a/src/IceRegAlloc.cpp
+++ b/src/IceRegAlloc.cpp
@@ -249,19 +249,17 @@
     break;
   }
 
-  struct CompareRanges {
-    bool operator()(const Variable *L, const Variable *R) {
+  auto CompareRanges = [](const Variable *L, const Variable *R) {
       InstNumberT Lstart = L->getLiveRange().getStart();
       InstNumberT Rstart = R->getLiveRange().getStart();
       if (Lstart == Rstart)
         return L->getIndex() < R->getIndex();
       return Lstart < Rstart;
-    }
   };
   // Do a reverse sort so that erasing elements (from the end) is fast.
-  std::sort(Unhandled.rbegin(), Unhandled.rend(), CompareRanges());
+  std::sort(Unhandled.rbegin(), Unhandled.rend(), CompareRanges);
   std::sort(UnhandledPrecolored.rbegin(), UnhandledPrecolored.rend(),
-            CompareRanges());
+            CompareRanges);
 
   Handled.reserve(Unhandled.size());
   Inactive.reserve(Unhandled.size());
diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h
index bb26090..8dad58e 100644
--- a/src/IceTargetLoweringX86BaseImpl.h
+++ b/src/IceTargetLoweringX86BaseImpl.h
@@ -3622,7 +3622,7 @@
     Variable *VecReg = nullptr;
 
     auto lowerSet = [this, &Base, SpreadValue, &VecReg](Type Ty,
-                                                       uint32_t OffsetAmt) {
+                                                        uint32_t OffsetAmt) {
       assert(Base != nullptr);
       Constant *Offset = OffsetAmt ? Ctx->getConstantInt32(OffsetAmt) : nullptr;
 
diff --git a/tests_lit/llvm2ice_tests/nacl-atomic-errors.ll b/tests_lit/llvm2ice_tests/nacl-atomic-errors.ll
index 6e58728..4f8ea1b 100644
--- a/tests_lit/llvm2ice_tests/nacl-atomic-errors.ll
+++ b/tests_lit/llvm2ice_tests/nacl-atomic-errors.ll
@@ -1,5 +1,6 @@
 ; Test that some errors trigger when the usage of NaCl atomic
 ; intrinsics does not match the required ABI.
+; REQUIRES: allow_dump
 
 ; RUN: %p2i -i %s --args --verbose none --exit-success -threads=0 2>&1 \
 ; RUN:   | FileCheck %s
diff --git a/tests_lit/llvm2ice_tests/reorder-basic-blocks.ll b/tests_lit/llvm2ice_tests/reorder-basic-blocks.ll
index 9df88eb..d390ff3 100644
--- a/tests_lit/llvm2ice_tests/reorder-basic-blocks.ll
+++ b/tests_lit/llvm2ice_tests/reorder-basic-blocks.ll
@@ -1,6 +1,6 @@
 ; Trivial smoke test of basic block reordering. Different random seeds should
 ; generate different basic block layout.
-; REQUIRES allow_dump
+; REQUIRES: allow_dump
 
 ; RUN: %p2i -i %s --filetype=asm --args -O2 -sz-seed=1 \
 ; RUN: -reorder-basic-blocks -threads=0 \
diff --git a/tests_lit/parse_errs/insertextract-err.ll b/tests_lit/parse_errs/insertextract-err.ll
index 560446a..7c2c1f8 100644
--- a/tests_lit/parse_errs/insertextract-err.ll
+++ b/tests_lit/parse_errs/insertextract-err.ll
@@ -4,12 +4,14 @@
 ; RUN:   | %if --need=allow_dump --command pnacl-freeze \
 ; RUN:   | %if --need=allow_dump --command not %pnacl_sz -notranslate \
 ; RUN:     -build-on-read -allow-pnacl-reader-error-recovery \
+; RUN:     -filetype=obj -o /dev/null \
 ; RUN:   | %if --need=allow_dump --command FileCheck %s
 
 ; RUN: %if --need=no_dump --command llvm-as < %s \
 ; RUN:   | %if --need=no_dump --command pnacl-freeze \
 ; RUN:   | %if --need=no_dump --command not %pnacl_sz -notranslate \
 ; RUN:     -build-on-read -allow-pnacl-reader-error-recovery \
+; RUN:     -filetype=obj -o /dev/null \
 ; RUN:   | %if --need=no_dump --command FileCheck %s --check-prefix=MIN
 
 define void @ExtractV4xi1(<4 x i1> %v, i32 %i) {
diff --git a/tests_lit/parse_errs/nacl-fake-intrinsic.ll b/tests_lit/parse_errs/nacl-fake-intrinsic.ll
index ba31eab..cef88d7 100644
--- a/tests_lit/parse_errs/nacl-fake-intrinsic.ll
+++ b/tests_lit/parse_errs/nacl-fake-intrinsic.ll
@@ -10,6 +10,7 @@
 ; RUN:       -verbose=inst -build-on-read \
 ; RUN:       -allow-pnacl-reader-error-recovery \
 ; RUN:       -allow-local-symbol-tables \
+; RUN:       -filetype=obj -o /dev/null \
 ; RUN:   | %if --need=allow_dump --command FileCheck %s
 
 ; RUN: %if --need=no_dump --command llvm-as < %s \
@@ -19,6 +20,7 @@
 ; RUN:       -verbose=inst -build-on-read \
 ; RUN:       -allow-pnacl-reader-error-recovery \
 ; RUN:       -allow-local-symbol-tables \
+; RUN:       -filetype=obj -o /dev/null \
 ; RUN:   | %if --need=no_dump --command FileCheck %s --check-prefix=MIN
 
 declare i32 @llvm.fake.i32(i32)