lib/Sema/SemaDeclAttr.cpp
bool Sema::CheckRegparmAttr(const ParsedAttr &AL, unsigned &numParams) {
  if (AL.isInvalid())
    return true;

  if (!checkAttributeNumArgs(*this, AL, 1)) {
    AL.setInvalid();
    return true;
  }

  uint32_t NP;
  Expr *NumParamsExpr = AL.getArgAsExpr(0);
  if (!checkUInt32Argument(*this, AL, NumParamsExpr, NP)) {
    AL.setInvalid();
    return true;
  }

  if (Context.getTargetInfo().getRegParmMax() == 0) {
    Diag(AL.getLoc(), diag::err_attribute_regparm_wrong_platform)
      << NumParamsExpr->getSourceRange();
    AL.setInvalid();
    return true;
  }

  numParams = NP;
  if (numParams > Context.getTargetInfo().getRegParmMax()) {
    Diag(AL.getLoc(), diag::err_attribute_regparm_invalid_number)
      << Context.getTargetInfo().getRegParmMax() << NumParamsExpr->getSourceRange();
    AL.setInvalid();
    return true;
  }

  return false;
}
/// Checks a regparm attribute, returning true if it is ill-formed and
/// otherwise setting numParams to the appropriate value.
Checks a regparm attribute, returning true if it is ill-formed and
otherwise setting numParams to the appropriate value.
Checks a regparm attribute returning true if it is ill - formed and otherwise setting numParams to the appropriate value .
bool Sema::CheckRegparmAttr(const ParsedAttr &AL, unsigned &numParams) {
  if (AL.isInvalid())
    return true;
  if (!checkAttributeNumArgs(*this, AL, 1)) {
    AL.setInvalid();
    return true;
  }
  uint32_t NP;
  Expr *NumParamsExpr = AL.getArgAsExpr(0);
  if (!checkUInt32Argument(*this, AL, NumParamsExpr, NP)) {
    AL.setInvalid();
    return true;
  }
  if (Context.getTargetInfo().getRegParmMax() == 0) {
    Diag(AL.getLoc(), diag::err_attribute_regparm_wrong_platform)
      << NumParamsExpr->getSourceRange();
    AL.setInvalid();
    return true;
  }
  numParams = NP;
  if (numParams > Context.getTargetInfo().getRegParmMax()) {
    Diag(AL.getLoc(), diag::err_attribute_regparm_invalid_number)
      << Context.getTargetInfo().getRegParmMax() << NumParamsExpr->getSourceRange();
    AL.setInvalid();
    return true;
  }
  return false;
}
bool Sema :: CheckRegparmAttr ( const ParsedAttr & AL , unsigned & numParams ) { if ( AL . isInvalid ( ) ) return true ; if ( ! checkAttributeNumArgs ( * this , AL , 1 ) ) { AL . setInvalid ( ) ; return true ; } uint32_t NP ; Expr * NumParamsExpr = AL . getArgAsExpr ( 0 ) ; if ( ! checkUInt32Argument ( * this , AL , NumParamsExpr , NP ) ) { AL . setInvalid ( ) ; return true ; } if ( Context . getTargetInfo ( ) . getRegParmMax ( ) == 0 ) { Diag ( AL . getLoc ( ) , diag :: err_attribute_regparm_wrong_platform ) << NumParamsExpr -> getSourceRange ( ) ; AL . setInvalid ( ) ; return true ; } numParams = NP ; if ( numParams > Context . getTargetInfo ( ) . getRegParmMax ( ) ) { Diag ( AL . getLoc ( ) , diag :: err_attribute_regparm_invalid_number ) << Context . getTargetInfo ( ) . getRegParmMax ( ) << NumParamsExpr -> getSourceRange ( ) ; AL . setInvalid ( ) ; return true ; } return false ; }
Checks a regparm attribute, returning true if it is ill-formed and
otherwise setting numParams to the appropriate value.
Checks a regparm attribute returning true if it is ill - formed and otherwise setting numParams to the appropriate value .