lib/Sema/SemaDeclAttr.cpp
static bool handleCommonAttributeFeatures(Sema &S, Decl *D,
                                          const ParsedAttr &AL) {
  // Several attributes carry different semantics than the parsing requires, so
  // those are opted out of the common argument checks.
  //
  // We also bail on unknown and ignored attributes because those are handled
  // as part of the target-specific handling logic.
  if (AL.getKind() == ParsedAttr::UnknownAttribute)
    return false;
  // Check whether the attribute requires specific language extensions to be
  // enabled.
  if (!AL.diagnoseLangOpts(S))
    return true;
  // Check whether the attribute appertains to the given subject.
  if (!AL.diagnoseAppertainsTo(S, D))
    return true;
  if (AL.hasCustomParsing())
    return false;

  if (AL.getMinArgs() == AL.getMaxArgs()) {
    // If there are no optional arguments, then checking for the argument count
    // is trivial.
    if (!checkAttributeNumArgs(S, AL, AL.getMinArgs()))
      return true;
  } else {
    // There are optional arguments, so checking is slightly more involved.
    if (AL.getMinArgs() &&
        !checkAttributeAtLeastNumArgs(S, AL, AL.getMinArgs()))
      return true;
    else if (!AL.hasVariadicArg() && AL.getMaxArgs() &&
             !checkAttributeAtMostNumArgs(S, AL, AL.getMaxArgs()))
      return true;
  }

  if (S.CheckAttrTarget(AL))
    return true;

  return false;
}
/// Handles semantic checking for features that are common to all attributes,
/// such as checking whether a parameter was properly specified, or the correct
/// number of arguments were passed, etc.
Handles semantic checking for features that are common to all attributes,
such as checking whether a parameter was properly specified, or the correct
number of arguments were passed, etc.
Handles semantic checking for features that are common to all attributes such as checking whether a parameter was properly specified or the correct number of arguments were passed etc .
static bool handleCommonAttributeFeatures(Sema &S, Decl *D,
                                          const ParsedAttr &AL) {
   We also bail on unknown and ignored attributes because those are handled
   as part of the target-specific handling logic.
  if (AL.getKind() == ParsedAttr::UnknownAttribute)
    return false;
   Check whether the attribute requires specific language extensions to be
   enabled.
  if (!AL.diagnoseLangOpts(S))
    return true;
   Check whether the attribute appertains to the given subject.
  if (!AL.diagnoseAppertainsTo(S, D))
    return true;
  if (AL.hasCustomParsing())
    return false;
  if (AL.getMinArgs() == AL.getMaxArgs()) {
     If there are no optional arguments, then checking for the argument count
     is trivial.
    if (!checkAttributeNumArgs(S, AL, AL.getMinArgs()))
      return true;
  } else {
     There are optional arguments, so checking is slightly more involved.
    if (AL.getMinArgs() &&
        !checkAttributeAtLeastNumArgs(S, AL, AL.getMinArgs()))
      return true;
    else if (!AL.hasVariadicArg() && AL.getMaxArgs() &&
             !checkAttributeAtMostNumArgs(S, AL, AL.getMaxArgs()))
      return true;
  }
  if (S.CheckAttrTarget(AL))
    return true;
  return false;
}
static bool handleCommonAttributeFeatures ( Sema & S , Decl * D , const ParsedAttr & AL ) { if ( AL . getKind ( ) == ParsedAttr :: UnknownAttribute ) return false ; if ( ! AL . diagnoseLangOpts ( S ) ) return true ; if ( ! AL . diagnoseAppertainsTo ( S , D ) ) return true ; if ( AL . hasCustomParsing ( ) ) return false ; if ( AL . getMinArgs ( ) == AL . getMaxArgs ( ) ) { if ( ! checkAttributeNumArgs ( S , AL , AL . getMinArgs ( ) ) ) return true ; } else { if ( AL . getMinArgs ( ) && ! checkAttributeAtLeastNumArgs ( S , AL , AL . getMinArgs ( ) ) ) return true ; else if ( ! AL . hasVariadicArg ( ) && AL . getMaxArgs ( ) && ! checkAttributeAtMostNumArgs ( S , AL , AL . getMaxArgs ( ) ) ) return true ; } if ( S . CheckAttrTarget ( AL ) ) return true ; return false ; }
Handles semantic checking for features that are common to all attributes,
such as checking whether a parameter was properly specified, or the correct
number of arguments were passed, etc.
Handles semantic checking for features that are common to all attributes such as checking whether a parameter was properly specified or the correct number of arguments were passed etc .
// Several attributes carry different semantics than the parsing requires, so // those are opted out of the common argument checks. // // We also bail on unknown and ignored attributes because those are handled // as part of the target-specific handling logic. // Check whether the attribute requires specific language extensions to be // enabled. // Check whether the attribute appertains to the given subject. // If there are no optional arguments, then checking for the argument count // is trivial. // There are optional arguments, so checking is slightly more involved.