From: Daniel Dunbar Date: Tue, 17 Nov 2009 08:07:16 +0000 (+0000) Subject: Add driver::types::isObjC predicate. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=77544fde702fdab2a6150ba812ecf04eb1e6eab6;p=clang Add driver::types::isObjC predicate. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89064 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/Types.h b/include/clang/Driver/Types.h index 92520a77b3..3a343b385e 100644 --- a/include/clang/Driver/Types.h +++ b/include/clang/Driver/Types.h @@ -62,6 +62,9 @@ namespace types { /// isCXX - Is this a "C++" input (C++ and Obj-C++ sources and headers). bool isCXX(ID Id); + /// isObjC - Is this an "ObjC" input (Obj-C and Obj-C++ sources and headers). + bool isObjC(ID Id); + /// lookupTypeForExtension - Lookup the type to use for the file /// extension \arg Ext. ID lookupTypeForExtension(const char *Ext); diff --git a/lib/Driver/Types.cpp b/lib/Driver/Types.cpp index c616c6a5bf..30893e7cc0 100644 --- a/lib/Driver/Types.cpp +++ b/lib/Driver/Types.cpp @@ -89,6 +89,19 @@ bool types::isAcceptedByClang(ID Id) { } } +bool types::isObjC(ID Id) { + switch (Id) { + default: + return false; + + case TY_ObjC: case TY_PP_ObjC: + case TY_ObjCXX: case TY_PP_ObjCXX: + case TY_ObjCHeader: case TY_PP_ObjCHeader: + case TY_ObjCXXHeader: case TY_PP_ObjCXXHeader: + return true; + } +} + bool types::isCXX(ID Id) { switch (Id) { default: