lib/Sema/SemaDeclAttr.cpp
static Optional<unsigned>
tryParseObjCMethodName(StringRef Name, SmallVectorImpl<StringRef> &SlotNames,
                       const LangOptions &LangOpts) {
  // Accept replacements starting with - or + as valid ObjC method names.
  if (!Name.empty() && (Name.front() == '-' || Name.front() == '+'))
    Name = Name.drop_front(1);
  if (Name.empty())
    return None;
  Name.split(SlotNames, ':');
  unsigned NumParams;
  if (Name.back() == ':') {
    // Remove an empty string at the end that doesn't represent any slot.
    SlotNames.pop_back();
    NumParams = SlotNames.size();
  } else {
    if (SlotNames.size() != 1)
      // Not a valid method name, just a colon-separated string.
      return None;
    NumParams = 0;
  }
  // Verify all slot names are valid.
  bool AllowDollar = LangOpts.DollarIdents;
  for (StringRef S : SlotNames) {
    if (S.empty())
      continue;
    if (!isValidIdentifier(S, AllowDollar))
      return None;
  }
  return NumParams;
}
/// Tries to parse a string as ObjC method name.
///
/// \param Name The string to parse. Expected to originate from availability
/// attribute argument.
/// \param SlotNames The vector that will be populated with slot names. In case
/// of unsuccessful parsing can contain invalid data.
/// \returns A number of method parameters if parsing was successful, None
/// otherwise.
Tries to parse a string as ObjC method name.
\param Name The string to parse. Expected to originate from availability
attribute argument.
\param SlotNames The vector that will be populated with slot names. In case
of unsuccessful parsing can contain invalid data.
\returns A number of method parameters if parsing was successful, None
otherwise.
Tries to parse a string as ObjC method name . \ param Name The string to parse . Expected to originate from availability attribute argument . \ param SlotNames The vector that will be populated with slot names . In case of unsuccessful parsing can contain invalid data . \ returns A number of method parameters if parsing was successful None otherwise .
static Optional<unsigned>
tryParseObjCMethodName(StringRef Name, SmallVectorImpl<StringRef> &SlotNames,
                       const LangOptions &LangOpts) {
  if (!Name.empty() && (Name.front() == '-' || Name.front() == '+'))
    Name = Name.drop_front(1);
  if (Name.empty())
    return None;
  Name.split(SlotNames, ':');
  unsigned NumParams;
  if (Name.back() == ':') {
    SlotNames.pop_back();
    NumParams = SlotNames.size();
  } else {
    if (SlotNames.size() != 1)
      return None;
    NumParams = 0;
  }
  bool AllowDollar = LangOpts.DollarIdents;
  for (StringRef S : SlotNames) {
    if (S.empty())
      continue;
    if (!isValidIdentifier(S, AllowDollar))
      return None;
  }
  return NumParams;
}
static Optional < unsigned > tryParseObjCMethodName ( StringRef Name , SmallVectorImpl < StringRef > & SlotNames , const LangOptions & LangOpts ) { if ( ! Name . empty ( ) && ( Name . front ( ) == ' ' || Name . front ( ) == ' ' ) ) Name = Name . drop_front ( 1 ) ; if ( Name . empty ( ) ) return None ; Name . split ( SlotNames , ' ' ) ; unsigned NumParams ; if ( Name . back ( ) == ' ' ) { SlotNames . pop_back ( ) ; NumParams = SlotNames . size ( ) ; } else { if ( SlotNames . size ( ) != 1 ) return None ; NumParams = 0 ; } bool AllowDollar = LangOpts . DollarIdents ; for ( StringRef S : SlotNames ) { if ( S . empty ( ) ) continue ; if ( ! isValidIdentifier ( S , AllowDollar ) ) return None ; } return NumParams ; }
Tries to parse a string as ObjC method name.
Tries to parse a string as ObjC method name .
// Accept replacements starting with - or + as valid ObjC method names. // Remove an empty string at the end that doesn't represent any slot. // Not a valid method name, just a colon-separated string. // Verify all slot names are valid.