changeset 7:eac3edb8778b

if extension is 'cbc' , set the default optimization level to 2
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Thu, 20 Jun 2013 15:02:26 +0900
parents c8782e147cac
children ac3ff95a8c30
files tools/clang/include/clang/Frontend/FrontendOptions.h tools/clang/lib/Frontend/CompilerInvocation.cpp tools/clang/lib/Frontend/FrontendActions.cpp tools/clang/lib/Frontend/FrontendOptions.cpp
diffstat 4 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tools/clang/include/clang/Frontend/FrontendOptions.h	Fri Jun 14 16:49:18 2013 +0900
+++ b/tools/clang/include/clang/Frontend/FrontendOptions.h	Thu Jun 20 15:02:26 2013 +0900
@@ -72,6 +72,9 @@
   IK_OpenCL,
   IK_CUDA,
   IK_AST,
+#ifndef noCbC
+  IK_CbC,
+#endif
   IK_LLVM_IR
 };
 
--- a/tools/clang/lib/Frontend/CompilerInvocation.cpp	Fri Jun 14 16:49:18 2013 +0900
+++ b/tools/clang/lib/Frontend/CompilerInvocation.cpp	Thu Jun 20 15:02:26 2013 +0900
@@ -66,6 +66,11 @@
   if (IK == IK_OpenCL && !Args.hasArg(OPT_cl_opt_disable))
     DefaultOpt = 2;
 
+#ifndef noCbC
+  if (IK == IK_CbC)
+    DefaultOpt = 2;
+#endif
+
   if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
     if (A->getOption().matches(options::OPT_O0))
       return 0;
@@ -790,7 +795,7 @@
       .Cases("ast", "pcm", IK_AST)
       .Case("ir", IK_LLVM_IR)
 #ifndef noCbC
-      .Case("cbc", IK_C)
+      .Case("cbc", IK_CbC)
 #endif
       .Default(IK_None);
     if (DashX == IK_None)
@@ -972,6 +977,9 @@
     case IK_PreprocessedC:
     case IK_ObjC:
     case IK_PreprocessedObjC:
+#ifndef noCbC
+    case IK_CbC:
+#endif
       LangStd = LangStandard::lang_gnu99;
       break;
     case IK_CXX:
@@ -1077,6 +1085,9 @@
       case IK_ObjC:
       case IK_PreprocessedC:
       case IK_PreprocessedObjC:
+#ifndef noCbC
+      case IK_CbC:
+#endif
         if (!(Std.isC89() || Std.isC99()))
           Diags.Report(diag::err_drv_argument_not_allowed_with)
             << A->getAsString(Args) << "C/ObjC";
--- a/tools/clang/lib/Frontend/FrontendActions.cpp	Fri Jun 14 16:49:18 2013 +0900
+++ b/tools/clang/lib/Frontend/FrontendActions.cpp	Thu Jun 20 15:02:26 2013 +0900
@@ -562,6 +562,9 @@
   case IK_ObjCXX:
   case IK_OpenCL:
   case IK_CUDA:
+#ifndef noCbC
+  case IK_CbC:
+#endif
     break;
       
   case IK_None:
--- a/tools/clang/lib/Frontend/FrontendOptions.cpp	Fri Jun 14 16:49:18 2013 +0900
+++ b/tools/clang/lib/Frontend/FrontendOptions.cpp	Thu Jun 20 15:02:26 2013 +0900
@@ -28,5 +28,8 @@
     .Case("cl", IK_OpenCL)
     .Case("cu", IK_CUDA)
     .Cases("ll", "bc", IK_LLVM_IR)
+#ifndef noCbC
+    .Case("cbc", IK_CbC)
+#endif
     .Default(IK_C);
 }