[cfe-commits] r89998 - /cfe/trunk/tools/clang-cc/Options.cpp

Daniel Dunbar daniel at zuster.org
Fri Nov 27 00:26:00 PST 2009


Author: ddunbar
Date: Fri Nov 27 02:26:00 2009
New Revision: 89998

URL: http://llvm.org/viewvc/llvm-project?rev=89998&view=rev
Log:
Simplify.

Modified:
    cfe/trunk/tools/clang-cc/Options.cpp

Modified: cfe/trunk/tools/clang-cc/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/Options.cpp?rev=89998&r1=89997&r2=89998&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/Options.cpp (original)
+++ cfe/trunk/tools/clang-cc/Options.cpp Fri Nov 27 02:26:00 2009
@@ -1031,40 +1031,21 @@
                                   FrontendOptions::InputKind IK) {
   using namespace langoptions;
 
-  switch (IK) {
-  case FrontendOptions::IK_None:
-  case FrontendOptions::IK_AST:
-    assert(0 && "Invalid input kind!");
-  case FrontendOptions::IK_Asm:
+  // Set some properties which depend soley on the input kind; it would be nice
+  // to move these to the language standard, and have the driver resolve the
+  // input kind + language standard.
+  if (IK == FrontendOptions::IK_Asm) {
     Options.AsmPreprocessor = 1;
-    // FALLTHROUGH
-  case FrontendOptions::IK_PreprocessedC:
-    // FALLTHROUGH
-  case FrontendOptions::IK_C:
-    // Do nothing.
-    break;
-  case FrontendOptions::IK_PreprocessedCXX:
-    // FALLTHROUGH
-  case FrontendOptions::IK_CXX:
-    Options.CPlusPlus = 1;
-    break;
-  case FrontendOptions::IK_PreprocessedObjC:
-    // FALLTHROUGH
-  case FrontendOptions::IK_ObjC:
+  } else if (IK == FrontendOptions::IK_ObjC ||
+             IK == FrontendOptions::IK_ObjCXX ||
+             IK == FrontendOptions::IK_PreprocessedObjC ||
+             IK == FrontendOptions::IK_PreprocessedObjCXX) {
     Options.ObjC1 = Options.ObjC2 = 1;
-    break;
-  case FrontendOptions::IK_PreprocessedObjCXX:
-    // FALLTHROUGH
-  case FrontendOptions::IK_ObjCXX:
-    Options.ObjC1 = Options.ObjC2 = 1;
-    Options.CPlusPlus = 1;
-    break;
-  case FrontendOptions::IK_OpenCL:
+  } else if (IK == FrontendOptions::IK_OpenCL) {
     Options.OpenCL = 1;
     Options.AltiVec = 1;
     Options.CXXOperatorNames = 1;
     Options.LaxVectorConversions = 1;
-    break;
   }
 
   if (ObjCExclusiveGC)





More information about the cfe-commits mailing list