lib/Sema/SemaDeclAttr.cpp
static Expr *makeLaunchBoundsArgExpr(Sema &S, Expr *E,
                                     const CUDALaunchBoundsAttr &AL,
                                     const unsigned Idx) {
  if (S.DiagnoseUnexpandedParameterPack(E))
    return nullptr;

  // Accept template arguments for now as they depend on something else.
  // We'll get to check them when they eventually get instantiated.
  if (E->isValueDependent())
    return E;

  llvm::APSInt I(64);
  if (!E->isIntegerConstantExpr(I, S.Context)) {
    S.Diag(E->getExprLoc(), diag::err_attribute_argument_n_type)
        << &AL << Idx << AANT_ArgumentIntegerConstant << E->getSourceRange();
    return nullptr;
  }
  // Make sure we can fit it in 32 bits.
  if (!I.isIntN(32)) {
    S.Diag(E->getExprLoc(), diag::err_ice_too_large) << I.toString(10, false)
                                                     << 32 << /* Unsigned */ 1;
    return nullptr;
  }
  if (I < 0)
    S.Diag(E->getExprLoc(), diag::warn_attribute_argument_n_negative)
        << &AL << Idx << E->getSourceRange();

  // We may need to perform implicit conversion of the argument.
  InitializedEntity Entity = InitializedEntity::InitializeParameter(
      S.Context, S.Context.getConstType(S.Context.IntTy), /*consume*/ false);
  ExprResult ValArg = S.PerformCopyInitialization(Entity, SourceLocation(), E);
  assert(!ValArg.isInvalid() &&
         "Unexpected PerformCopyInitialization() failure.");

  return ValArg.getAs<Expr>();
}
// Checks whether an argument of launch_bounds attribute is
// acceptable, performs implicit conversion to Rvalue, and returns
// non-nullptr Expr result on success. Otherwise, it returns nullptr
// and may output an error.
Checks whether an argument of launch_bounds attribute is
acceptable, performs implicit conversion to Rvalue, and returns
non-nullptr Expr result on success. Otherwise, it returns nullptr
and may output an error.
Checks whether an argument of launch_bounds attribute is acceptable performs implicit conversion to Rvalue and returns non - nullptr Expr result on success . Otherwise it returns nullptr and may output an error .
static Expr *makeLaunchBoundsArgExpr(Sema &S, Expr *E,
                                     const CUDALaunchBoundsAttr &AL,
                                     const unsigned Idx) {
  if (S.DiagnoseUnexpandedParameterPack(E))
    return nullptr;
  if (E->isValueDependent())
    return E;
  llvm::APSInt I(64);
  if (!E->isIntegerConstantExpr(I, S.Context)) {
    S.Diag(E->getExprLoc(), diag::err_attribute_argument_n_type)
        << &AL << Idx << AANT_ArgumentIntegerConstant << E->getSourceRange();
    return nullptr;
  }
  if (!I.isIntN(32)) {
    S.Diag(E->getExprLoc(), diag::err_ice_too_large) << I.toString(10, false)
                                                     << 32 <<  1;
    return nullptr;
  }
  if (I < 0)
    S.Diag(E->getExprLoc(), diag::warn_attribute_argument_n_negative)
        << &AL << Idx << E->getSourceRange();
  InitializedEntity Entity = InitializedEntity::InitializeParameter(
      S.Context, S.Context.getConstType(S.Context.IntTy),  false);
  ExprResult ValArg = S.PerformCopyInitialization(Entity, SourceLocation(), E);
  assert(!ValArg.isInvalid() &&
         "Unexpected PerformCopyInitialization() failure.");
  return ValArg.getAs<Expr>();
}
static Expr * makeLaunchBoundsArgExpr ( Sema & S , Expr * E , const CUDALaunchBoundsAttr & AL , const unsigned Idx ) { if ( S . DiagnoseUnexpandedParameterPack ( E ) ) return nullptr ; if ( E -> isValueDependent ( ) ) return E ; llvm :: APSInt I ( 64 ) ; if ( ! E -> isIntegerConstantExpr ( I , S . Context ) ) { S . Diag ( E -> getExprLoc ( ) , diag :: err_attribute_argument_n_type ) << & AL << Idx << AANT_ArgumentIntegerConstant << E -> getSourceRange ( ) ; return nullptr ; } if ( ! I . isIntN ( 32 ) ) { S . Diag ( E -> getExprLoc ( ) , diag :: err_ice_too_large ) << I . toString ( 10 , false ) << 32 << 1 ; return nullptr ; } if ( I < 0 ) S . Diag ( E -> getExprLoc ( ) , diag :: warn_attribute_argument_n_negative ) << & AL << Idx << E -> getSourceRange ( ) ; InitializedEntity Entity = InitializedEntity :: InitializeParameter ( S . Context , S . Context . getConstType ( S . Context . IntTy ) , false ) ; ExprResult ValArg = S . PerformCopyInitialization ( Entity , SourceLocation ( ) , E ) ; assert ( ! ValArg . isInvalid ( ) && " " ) ; return ValArg . getAs < Expr > ( ) ; }
Checks whether an argument of launch_bounds attribute is
acceptable, performs implicit conversion to Rvalue, and returns
non-nullptr Expr result on success.
Checks whether an argument of launch_bounds attribute is acceptable performs implicit conversion to Rvalue and returns non - nullptr Expr result on success .
// Accept template arguments for now as they depend on something else. // We'll get to check them when they eventually get instantiated. // Make sure we can fit it in 32 bits. /* Unsigned */ // We may need to perform implicit conversion of the argument. /*consume*/