]> granicus.if.org Git - clang/commitdiff
Fix -Wlarge-by-value-copy option handling in the driver.
authorJean-Daniel Dupas <devlists@shadowlab.org>
Fri, 4 May 2012 08:08:37 +0000 (08:08 +0000)
committerJean-Daniel Dupas <devlists@shadowlab.org>
Fri, 4 May 2012 08:08:37 +0000 (08:08 +0000)
CC1 supports only the joined format.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156161 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/warning-options.cpp [new file with mode: 0644]

index 9448425a424eeb3af573f322ad0b9049a17d3a01..90a9f0cf947054aa636afc20b7341e1c8fe3227c 100644 (file)
@@ -2018,11 +2018,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
 
   if (Arg *A = Args.getLastArg(options::OPT_Wlarge_by_value_copy_EQ,
                                options::OPT_Wlarge_by_value_copy_def)) {
-    CmdArgs.push_back("-Wlarge-by-value-copy");
-    if (A->getNumValues())
-      CmdArgs.push_back(A->getValue(Args));
-    else
-      CmdArgs.push_back("64"); // default value for -Wlarge-by-value-copy.
+    if (A->getNumValues()) {
+      StringRef bytes = A->getValue(Args);
+      CmdArgs.push_back(Args.MakeArgString("-Wlarge-by-value-copy=" + bytes));
+    else
+      CmdArgs.push_back("-Wlarge-by-value-copy=64"); // default value
   }
 
   if (Args.hasArg(options::OPT__relocatable_pch))
diff --git a/test/Driver/warning-options.cpp b/test/Driver/warning-options.cpp
new file mode 100644 (file)
index 0000000..a36210d
--- /dev/null
@@ -0,0 +1,4 @@
+// RUN: %clang -### -Wlarge-by-value-copy %s 2>&1 | FileCheck -check-prefix=LARGE_VALUE_COPY_DEFAULT %s
+// LARGE_VALUE_COPY_DEFAULT: -Wlarge-by-value-copy=64
+// RUN: %clang -### -Wlarge-by-value-copy=128 %s 2>&1 | FileCheck -check-prefix=LARGE_VALUE_COPY_JOINED %s
+// LARGE_VALUE_COPY_JOINED: -Wlarge-by-value-copy=128