[cfe-commits] r74217 - in /cfe/trunk: include/clang/Basic/LangOptions.h tools/clang-cc/clang-cc.cpp
Nate Begeman
natebegeman at mac.com
Thu Jun 25 15:43:10 PDT 2009
Author: sampo
Date: Thu Jun 25 17:43:10 2009
New Revision: 74217
URL: http://llvm.org/viewvc/llvm-project?rev=74217&view=rev
Log:
OpenCL 1.0 patch 2/N: Language options & file extension
Modified:
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=74217&r1=74216&r2=74217&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Thu Jun 25 17:43:10 2009
@@ -43,6 +43,7 @@
unsigned PascalStrings : 1; // Allow Pascal strings
unsigned WritableStrings : 1; // Allow writable strings
unsigned LaxVectorConversions : 1;
+ unsigned AltiVec : 1; // Support AltiVec-style vector initializers.
unsigned Exceptions : 1; // Support exception handling.
unsigned NeXTRuntime : 1; // Use NeXT runtime.
@@ -80,6 +81,10 @@
unsigned AccessControl : 1; // Whether C++ access control should
// be enabled.
unsigned CharIsSigned : 1; // Whether char is a signed or unsigned type
+
+ unsigned OpenCL : 1; // OpenCL C99 language extensions.
+
+
private:
unsigned GC : 2; // Objective-C Garbage Collection modes. We declare
// this enum as unsigned because MSVC insists on making enums
@@ -111,6 +116,7 @@
Exceptions = NeXTRuntime = Freestanding = NoBuiltin = 0;
LaxVectorConversions = 1;
HeinousExtensions = 0;
+ AltiVec = OpenCL = 0;
SymbolVisibility = (unsigned) Default;
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=74217&r1=74216&r2=74217&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Thu Jun 25 17:43:10 2009
@@ -315,13 +315,15 @@
langkind_objc,
langkind_objc_cpp,
langkind_objcxx,
- langkind_objcxx_cpp
+ langkind_objcxx_cpp,
+ langkind_ocl
};
static llvm::cl::opt<LangKind>
BaseLang("x", llvm::cl::desc("Base language to compile"),
llvm::cl::init(langkind_unspecified),
llvm::cl::values(clEnumValN(langkind_c, "c", "C"),
+ clEnumValN(langkind_ocl, "cl", "OpenCL C"),
clEnumValN(langkind_cxx, "c++", "C++"),
clEnumValN(langkind_objc, "objective-c", "Objective C"),
clEnumValN(langkind_objcxx,"objective-c++","Objective C++"),
@@ -432,6 +434,8 @@
else if (Ext == "C" || Ext == "cc" || Ext == "cpp" || Ext == "CPP" ||
Ext == "c++" || Ext == "cp" || Ext == "cxx")
return langkind_cxx;
+ else if (Ext == "cl")
+ return langkind_ocl;
else
return langkind_c;
}
@@ -480,6 +484,12 @@
Options.ObjC1 = Options.ObjC2 = 1;
Options.CPlusPlus = 1;
break;
+ case langkind_ocl:
+ Options.OpenCL = 1;
+ Options.AltiVec = 1;
+ Options.CXXOperatorNames = 1;
+ Options.LaxVectorConversions = 1;
+ break;
}
if (ObjCExclusiveGC)
@@ -664,6 +674,9 @@
// Based on the base language, pick one.
switch (LK) {
case lang_unspecified: assert(0 && "Unknown base language");
+ case langkind_ocl:
+ LangStd = lang_c99;
+ break;
case langkind_c:
case langkind_asm_cpp:
case langkind_c_cpp:
@@ -1622,7 +1635,7 @@
PrintSourceRangeInfo,
PrintDiagnosticOption,
!NoDiagnosticsFixIt,
- MessageLength));
+ MessageLength));
}
virtual void setLangOptions(const LangOptions *LO) {
More information about the cfe-commits
mailing list