diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/AST/NSAPI.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/AST/NSAPI.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/contrib/llvm/tools/clang/lib/AST/NSAPI.cpp b/contrib/llvm/tools/clang/lib/AST/NSAPI.cpp index 986b3b5..3dc750a 100644 --- a/contrib/llvm/tools/clang/lib/AST/NSAPI.cpp +++ b/contrib/llvm/tools/clang/lib/AST/NSAPI.cpp @@ -10,6 +10,7 @@ #include "clang/AST/NSAPI.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Expr.h" +#include "llvm/ADT/StringSwitch.h" using namespace clang; @@ -46,6 +47,10 @@ Selector NSAPI::getNSStringSelector(NSStringMethodKind MK) const { Sel = Ctx.Selectors.getUnarySelector( &Ctx.Idents.get("stringWithUTF8String")); break; + case NSStr_initWithUTF8String: + Sel = Ctx.Selectors.getUnarySelector( + &Ctx.Idents.get("initWithUTF8String")); + break; case NSStr_stringWithCStringEncoding: { IdentifierInfo *KeyIdents[] = { &Ctx.Idents.get("stringWithCString"), @@ -379,6 +384,32 @@ bool NSAPI::isObjCNSUIntegerType(QualType T) const { return isObjCTypedef(T, "NSUInteger", NSUIntegerId); } +StringRef NSAPI::GetNSIntegralKind(QualType T) const { + if (!Ctx.getLangOpts().ObjC1 || T.isNull()) + return StringRef(); + + while (const TypedefType *TDT = T->getAs<TypedefType>()) { + StringRef NSIntegralResust = + llvm::StringSwitch<StringRef>( + TDT->getDecl()->getDeclName().getAsIdentifierInfo()->getName()) + .Case("int8_t", "int8_t") + .Case("int16_t", "int16_t") + .Case("int32_t", "int32_t") + .Case("NSInteger", "NSInteger") + .Case("int64_t", "int64_t") + .Case("uint8_t", "uint8_t") + .Case("uint16_t", "uint16_t") + .Case("uint32_t", "uint32_t") + .Case("NSUInteger", "NSUInteger") + .Case("uint64_t", "uint64_t") + .Default(StringRef()); + if (!NSIntegralResust.empty()) + return NSIntegralResust; + T = TDT->desugar(); + } + return StringRef(); +} + bool NSAPI::isObjCTypedef(QualType T, StringRef name, IdentifierInfo *&II) const { if (!Ctx.getLangOpts().ObjC1) |