[cfe-commits] r129145 - in /cfe/trunk: include/clang/Driver/Options.td lib/Driver/Tools.cpp

Evan Cheng evan.cheng at apple.com
Fri Apr 8 11:47:41 PDT 2011


Author: evancheng
Date: Fri Apr  8 13:47:41 2011
New Revision: 129145

URL: http://llvm.org/viewvc/llvm-project?rev=129145&view=rev
Log:
Add -mtrap_function=<> option. rdar://9257465

Modified:
    cfe/trunk/include/clang/Driver/Options.td
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=129145&r1=129144&r2=129145&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Apr  8 13:47:41 2011
@@ -542,6 +542,8 @@
 def maes : Flag<"-maes">, Group<m_x86_Features_Group>;
 def mavx : Flag<"-mavx">, Group<m_x86_Features_Group>;
 def mthumb : Flag<"-mthumb">, Group<m_Group>;
+def mtrap_function_EQ : Joined<"-mtrap-function=">, Group<m_Group>,
+  HelpText<"Issue call to specified function rather than a trap instruction">;
 def mtune_EQ : Joined<"-mtune=">, Group<m_Group>;
 def multi__module : Flag<"-multi_module">;
 def multiply__defined__unused : Separate<"-multiply_defined_unused">;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=129145&r1=129144&r2=129145&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Apr  8 13:47:41 2011
@@ -605,6 +605,17 @@
     CmdArgs.push_back("-neon");
   }
 
+  // Forward -mtrap_function= options to the backend.
+  for (arg_iterator it = Args.filtered_begin(options::OPT_mtrap_function_EQ),
+         ie = Args.filtered_end(); it != ie; ++it) {
+    const Arg *A = *it;
+    A->claim();
+    assert(A->getNumValues() == 1 && "-mtrap_function= expects one argument.");
+    llvm::StringRef FuncName = A->getValue(Args, 0);
+    CmdArgs.push_back("-backend-option");
+    CmdArgs.push_back(Args.MakeArgString("-arm-trap-func=" + FuncName));
+  }
+
   // Kernel code has more strict alignment requirements.
   if (KernelOrKext) {
     CmdArgs.push_back("-backend-option");





More information about the cfe-commits mailing list