From e3b557809604d036af6e00c60f012c2025b59a5e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 11 Feb 2023 13:38:04 +0100 Subject: Vendor import of llvm-project main llvmorg-16-init-18548-gb0daacf58f41, the last commit before the upstream release/17.x branch was created. --- clang/lib/AST/NSAPI.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'clang/lib/AST/NSAPI.cpp') diff --git a/clang/lib/AST/NSAPI.cpp b/clang/lib/AST/NSAPI.cpp index db7878e18c42..3621a2eaa573 100644 --- a/clang/lib/AST/NSAPI.cpp +++ b/clang/lib/AST/NSAPI.cpp @@ -11,6 +11,7 @@ #include "clang/AST/DeclObjC.h" #include "clang/AST/Expr.h" #include "llvm/ADT/StringSwitch.h" +#include using namespace clang; @@ -142,14 +143,15 @@ Selector NSAPI::getNSArraySelector(NSArrayMethodKind MK) const { return NSArraySelectors[MK]; } -Optional NSAPI::getNSArrayMethodKind(Selector Sel) { +std::optional +NSAPI::getNSArrayMethodKind(Selector Sel) { for (unsigned i = 0; i != NumNSArrayMethods; ++i) { NSArrayMethodKind MK = NSArrayMethodKind(i); if (Sel == getNSArraySelector(MK)) return MK; } - return None; + return std::nullopt; } Selector NSAPI::getNSDictionarySelector( @@ -243,7 +245,7 @@ Selector NSAPI::getNSDictionarySelector( return NSDictionarySelectors[MK]; } -Optional +std::optional NSAPI::getNSDictionaryMethodKind(Selector Sel) { for (unsigned i = 0; i != NumNSDictionaryMethods; ++i) { NSDictionaryMethodKind MK = NSDictionaryMethodKind(i); @@ -251,7 +253,7 @@ NSAPI::getNSDictionaryMethodKind(Selector Sel) { return MK; } - return None; + return std::nullopt; } Selector NSAPI::getNSSetSelector(NSSetMethodKind MK) const { @@ -300,15 +302,14 @@ Selector NSAPI::getNSSetSelector(NSSetMethodKind MK) const { return NSSetSelectors[MK]; } -Optional -NSAPI::getNSSetMethodKind(Selector Sel) { +std::optional NSAPI::getNSSetMethodKind(Selector Sel) { for (unsigned i = 0; i != NumNSSetMethods; ++i) { NSSetMethodKind MK = NSSetMethodKind(i); if (Sel == getNSSetSelector(MK)) return MK; } - return None; + return std::nullopt; } Selector NSAPI::getNSNumberLiteralSelector(NSNumberLiteralMethodKind MK, @@ -363,7 +364,7 @@ Selector NSAPI::getNSNumberLiteralSelector(NSNumberLiteralMethodKind MK, return Sels[MK]; } -Optional +std::optional NSAPI::getNSNumberLiteralMethodKind(Selector Sel) const { for (unsigned i = 0; i != NumNSNumberLiteralMethods; ++i) { NSNumberLiteralMethodKind MK = NSNumberLiteralMethodKind(i); @@ -371,14 +372,14 @@ NSAPI::getNSNumberLiteralMethodKind(Selector Sel) const { return MK; } - return None; + return std::nullopt; } -Optional +std::optional NSAPI::getNSNumberFactoryMethodKind(QualType T) const { const BuiltinType *BT = T->getAs(); if (!BT) - return None; + return std::nullopt; const TypedefType *TDT = T->getAs(); if (TDT) { @@ -496,7 +497,7 @@ NSAPI::getNSNumberFactoryMethodKind(QualType T) const { break; } - return None; + return std::nullopt; } /// Returns true if \param T is a typedef of "BOOL" in objective-c. -- cgit v1.2.3