Fix: 'sink' handling was broken.
authorMikhail Glushenkov <foldr@codedgers.com>
Fri, 30 May 2008 06:23:29 +0000 (06:23 +0000)
committerMikhail Glushenkov <foldr@codedgers.com>
Fri, 30 May 2008 06:23:29 +0000 (06:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51750 91177308-0d34-0410-b5e6-96231b3b80d8

test/LLVMC/sink.c [new file with mode: 0644]
utils/TableGen/LLVMCConfigurationEmitter.cpp

diff --git a/test/LLVMC/sink.c b/test/LLVMC/sink.c
new file mode 100644 (file)
index 0000000..d1dde41
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * Check that the 'sink' options work.
+ * RUN: llvmc2 -v -Wall %s -o %t |& grep "Wall"
+ * RUN: ./%t | grep hello
+ */
+
+#include <stdio.h>
+
+int main() {
+    printf("hello\n");
+    return 0;
+}
index f527defe450b4c5acd36e61d8ec4c5ed6e5a9014..45f6a13d2305bb16f9dba47adb193d695ea4805c 100644 (file)
@@ -1015,10 +1015,10 @@ void EmitCmdLineVecFill(const Init* CmdLine, const std::string& ToolName,
       O << "vec.push_back(\"" << cmd << "\");\n";
     }
   }
-  O << IndentLevel << "ret = Action("
+  O << IndentLevel << "cmd = "
     << ((StrVec[0][0] == '$') ? SubstituteSpecialCommands(StrVec[0])
         : "\"" + StrVec[0] + "\"")
-    << ", vec);\n";
+    << ";\n";
 }
 
 /// EmitCmdLineVecFillCallback - A function object wrapper around
@@ -1052,7 +1052,7 @@ void EmitGenerateActionMethod (const ToolProperties& P,
   O << Indent2 << "const sys::Path& outFile,\n"
     << Indent2 << "const InputLanguagesSet& InLangs) const\n"
     << Indent1 << "{\n"
-    << Indent2 << "Action ret;\n"
+    << Indent2 << "std::string cmd;\n"
     << Indent2 << "std::vector<std::string> vec;\n";
 
   // cmd_line is either a string or a 'case' construct.
@@ -1078,7 +1078,7 @@ void EmitGenerateActionMethod (const ToolProperties& P,
       << Indent2 << "}\n";
   }
 
-  O << Indent2 << "return ret;\n"
+  O << Indent2 << "return Action(cmd, vec);\n"
     << Indent1 << "}\n\n";
 }
 
@@ -1214,7 +1214,7 @@ void EmitOptionDescriptions (const GlobalOptionDescriptions& descs,
 {
   std::vector<GlobalOptionDescription> Aliases;
 
-  // Emit static cl::Option variables
+  // Emit static cl::Option variables.
   for (GlobalOptionDescriptions::const_iterator B = descs.begin(),
          E = descs.end(); B!=E; ++B) {
     const GlobalOptionDescription& val = B->second;