Do not generate empty 'if's for the output_suffix property.
authorMikhail Glushenkov <foldr@codedgers.com>
Fri, 30 May 2008 06:15:20 +0000 (06:15 +0000)
committerMikhail Glushenkov <foldr@codedgers.com>
Fri, 30 May 2008 06:15:20 +0000 (06:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51737 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvmc2/Tools.td
utils/TableGen/LLVMCConfigurationEmitter.cpp

index 42060e3b2cf40379ffdadc6927d089cb0a174f38..ae60874ea8f50a87b331ca389ad8a60ae95893c5 100644 (file)
@@ -27,7 +27,7 @@ def llvm_gcc_c : Tool<
  (output_suffix "bc"),
  (cmd_line (case
             (switch_on "E"),
-              "llvm-g++ -E -x c $INFILE -o $OUTFILE -emit-llvm",
+              "llvm-g++ -E -x c $INFILE -o $OUTFILE",
             (default),
               "llvm-g++ -c -x c $INFILE -o $OUTFILE -emit-llvm")),
  (switch_option "E", (stop_compilation),(output_suffix "i"),
@@ -41,7 +41,7 @@ def llvm_gcc_cpp : Tool<
  (output_suffix "bc"),
  (cmd_line (case
             (switch_on "E"),
-              "llvm-g++ -E -x c++ $INFILE -o $OUTFILE -emit-llvm",
+              "llvm-g++ -E -x c++ $INFILE -o $OUTFILE",
             (default),
               "llvm-g++ -c -x c++ $INFILE -o $OUTFILE -emit-llvm")),
  (switch_option "E", (stop_compilation), (output_suffix "i")),
index 93fe90b1ee8a37aceec34acd6b13c0d0ecd43c4e..a29492817d2484f7c31ed621e24ced182f5e2d16 100644 (file)
@@ -790,12 +790,20 @@ void EmitForwardOptionPropertyHandlingCode (const ToolOptionDescription& D,
   }
 }
 
-// A helper function used by EmitOptionPropertyHandlingCode() that
-// tells us whether we should emit any code at all.
+// ToolOptionHasInterestingProperties - A helper function used by
+// EmitOptionPropertyHandlingCode() that tells us whether we should
+// emit any property handling code at all.
 bool ToolOptionHasInterestingProperties(const ToolOptionDescription& D) {
-  if (!D.isForward() && !D.isUnpackValues() && D.Props.empty())
-    return false;
-  return true;
+  bool ret = false;
+  for (OptionPropertyList::const_iterator B = D.Props.begin(),
+         E = D.Props.end(); B != E; ++B) {
+      const OptionProperty& OptProp = *B;
+      if (OptProp.first == OptionPropertyType::AppendCmd)
+        ret = true;
+    }
+  if (D.isForward() || D.isUnpackValues())
+    ret = true;
+  return ret;
 }
 
 /// EmitOptionPropertyHandlingCode - Helper function used by