[cfe-commits] r156161 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/warning-options.cpp

Jean-Daniel Dupas devlists at shadowlab.org
Fri May 4 01:08:37 PDT 2012


Author: jddupas
Date: Fri May  4 03:08:37 2012
New Revision: 156161

URL: http://llvm.org/viewvc/llvm-project?rev=156161&view=rev
Log:
Fix -Wlarge-by-value-copy option handling in the driver.
CC1 supports only the joined format.


Added:
    cfe/trunk/test/Driver/warning-options.cpp   (with props)
Modified:
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=156161&r1=156160&r2=156161&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri May  4 03:08:37 2012
@@ -2018,11 +2018,11 @@
 
   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))

Added: cfe/trunk/test/Driver/warning-options.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/warning-options.cpp?rev=156161&view=auto
==============================================================================
--- cfe/trunk/test/Driver/warning-options.cpp (added)
+++ cfe/trunk/test/Driver/warning-options.cpp Fri May  4 03:08:37 2012
@@ -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

Propchange: cfe/trunk/test/Driver/warning-options.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/trunk/test/Driver/warning-options.cpp
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=utf-8





More information about the cfe-commits mailing list