[cfe-commits] r66986 - in /cfe/trunk: include/clang/Driver/Types.h lib/Driver/Types.cpp
Daniel Dunbar
daniel at zuster.org
Fri Mar 13 16:46:19 PDT 2009
Author: ddunbar
Date: Fri Mar 13 18:46:19 2009
New Revision: 66986
URL: http://llvm.org/viewvc/llvm-project?rev=66986&view=rev
Log:
Driver: Add types::{isAcceptedByClang,isCXX} predicates.
Modified:
cfe/trunk/include/clang/Driver/Types.h
cfe/trunk/lib/Driver/Types.cpp
Modified: cfe/trunk/include/clang/Driver/Types.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.h?rev=66986&r1=66985&r2=66986&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Types.h (original)
+++ cfe/trunk/include/clang/Driver/Types.h Fri Mar 13 18:46:19 2009
@@ -56,6 +56,12 @@
/// types).
bool canLipoType(ID Id);
+ /// isAcceptedByClang - Can clang handle this input type.
+ bool isAcceptedByClang(ID Id);
+
+ /// isCXX - Is this a "C++" input (C++ and Obj-C++ sources and headers).
+ bool isCXX(ID Id);
+
/// lookupTypeForExtension - Lookup the type to use for the file
/// extension \arg Ext.
ID lookupTypeForExtension(const char *Ext);
Modified: cfe/trunk/lib/Driver/Types.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Types.cpp?rev=66986&r1=66985&r2=66986&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Types.cpp (original)
+++ cfe/trunk/lib/Driver/Types.cpp Fri Mar 13 18:46:19 2009
@@ -69,6 +69,37 @@
Id == TY_Object);
}
+bool types::isAcceptedByClang(ID Id) {
+ switch (Id) {
+ default:
+ return false;
+
+ case TY_Asm:
+ case TY_C: case TY_PP_C:
+ case TY_ObjC: case TY_PP_ObjC:
+ case TY_CXX: case TY_PP_CXX:
+ case TY_ObjCXX: case TY_PP_ObjCXX:
+ case TY_CHeader: case TY_PP_CHeader:
+ case TY_ObjCHeader: case TY_PP_ObjCHeader:
+ case TY_CXXHeader: case TY_PP_CXXHeader:
+ case TY_ObjCXXHeader: case TY_PP_ObjCXXHeader:
+ return true;
+ }
+}
+
+bool types::isCXX(ID Id) {
+ switch (Id) {
+ default:
+ return false;
+
+ case TY_CXX: case TY_PP_CXX:
+ case TY_ObjCXX: case TY_PP_ObjCXX:
+ case TY_CXXHeader: case TY_PP_CXXHeader:
+ case TY_ObjCXXHeader: case TY_PP_ObjCXXHeader:
+ return true;
+ }
+}
+
types::ID types::lookupTypeForExtension(const char *Ext) {
unsigned N = strlen(Ext);
More information about the cfe-commits
mailing list