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

Daniel Dunbar daniel at zuster.org
Sat Nov 28 19:18:48 PST 2009


Author: ddunbar
Date: Sat Nov 28 21:18:48 2009
New Revision: 90058

URL: http://llvm.org/viewvc/llvm-project?rev=90058&view=rev
Log:
clang-cc: Tweak LangOptions parsing to make it a bit more obvious what depends on what.

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=90058&r1=90057&r2=90058&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/Options.cpp (original)
+++ cfe/trunk/tools/clang-cc/Options.cpp Sat Nov 28 21:18:48 2009
@@ -1047,11 +1047,6 @@
              IK == FrontendOptions::IK_PreprocessedObjC ||
              IK == FrontendOptions::IK_PreprocessedObjCXX) {
     Options.ObjC1 = Options.ObjC2 = 1;
-  } else if (IK == FrontendOptions::IK_OpenCL) {
-    Options.OpenCL = 1;
-    Options.AltiVec = 1;
-    Options.CXXOperatorNames = 1;
-    Options.LaxVectorConversions = 1;
   }
 
   if (LangStd == LangStandard::lang_unspecified) {
@@ -1085,10 +1080,22 @@
   Options.CPlusPlus = Std.isCPlusPlus();
   Options.CPlusPlus0x = Std.isCPlusPlus0x();
   Options.Digraphs = Std.hasDigraphs();
+  Options.GNUInline = !Std.isC99();
   Options.GNUMode = Std.isGNUMode();
   Options.HexFloats = Std.hasHexFloats();
   Options.ImplicitInt = Std.hasImplicitInt();
 
+  // OpenCL has some additional defaults.
+  if (LangStd == LangStandard::lang_opencl) {
+    Options.OpenCL = 1;
+    Options.AltiVec = 1;
+    Options.CXXOperatorNames = 1;
+    Options.LaxVectorConversions = 1;
+  }
+
+  // OpenCL and C++ both have bool, true, false keywords.
+  Options.Bool = Options.OpenCL || Options.CPlusPlus;
+
   if (Options.CPlusPlus)
     Options.CXXOperatorNames = !NoOperatorNames;
 
@@ -1122,10 +1129,8 @@
   if (!Options.ObjC1 && !Options.GNUMode)
     Options.Blocks = 0;
 
-  // Default to not accepting '$' in identifiers when preprocessing assembler,
-  // but do accept when preprocessing C.  FIXME: these defaults are right for
-  // darwin, are they right everywhere?
-  Options.DollarIdents = IK != FrontendOptions::IK_Asm;
+  // Default to not accepting '$' in identifiers when preprocessing assembler.
+  Options.DollarIdents = !Options.AsmPreprocessor;
   if (DollarsInIdents.getPosition())  // Explicit setting overrides default.
     Options.DollarIdents = DollarsInIdents;
 
@@ -1156,9 +1161,6 @@
 
   Options.ElideConstructors = !NoElideConstructors;
 
-  // OpenCL and C++ both have bool, true, false keywords.
-  Options.Bool = Options.OpenCL || Options.CPlusPlus;
-
   Options.MathErrno = !NoMathErrno;
 
   if (TemplateDepth.getPosition())
@@ -1169,7 +1171,7 @@
     Options.NeXTRuntime = 0;
 
   if (!ObjCConstantStringClass.empty())
-    Options.ObjCConstantStringClass = ObjCConstantStringClass.c_str();
+    Options.ObjCConstantStringClass = ObjCConstantStringClass;
 
   if (ObjCNonFragileABI)
     Options.ObjCNonFragileABI = 1;
@@ -1186,8 +1188,6 @@
   assert(PICLevel <= 2 && "Invalid value for -pic-level");
   Options.PICLevel = PICLevel;
 
-  Options.GNUInline = !Options.C99;
-
   // This is the __NO_INLINE__ define, which just depends on things like the
   // optimization level and -fno-inline, not actually whether the backend has
   // inlining enabled.





More information about the cfe-commits mailing list