diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-07-24 14:51:23 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-07-24 14:51:23 +0000 |
commit | 31f42318d833f54a7535dbe63244e765e98780dc (patch) | |
tree | 5206280b0e7010a0586c785d6a4149bde6771c22 /clang/lib/Sema/SemaExpr.cpp | |
parent | 9414665a3b0bd525f84d76e24048ca60ebe6c710 (diff) | |
download | bcm5719-llvm-31f42318d833f54a7535dbe63244e765e98780dc.tar.gz bcm5719-llvm-31f42318d833f54a7535dbe63244e765e98780dc.zip |
Improving the "integer constant too large" diagnostics based on post-commit feedback from Richard Smith. Amends r213657.
llvm-svn: 213865
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 3062e4274f9..163973bd55f 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3117,8 +3117,8 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { } else { llvm::APInt ResultVal(Context.getTargetInfo().getLongLongWidth(), 0); if (Literal.GetIntegerValue(ResultVal)) - Diag(Tok.getLocation(), diag::err_integer_too_large) - << ResultVal.getBitWidth(); + Diag(Tok.getLocation(), diag::err_integer_literal_too_large) + << /* Unsigned */ 1; Lit = IntegerLiteral::Create(Context, ResultVal, CookedTy, Tok.getLocation()); } @@ -3211,8 +3211,8 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { if (Literal.GetIntegerValue(ResultVal)) { // If this value didn't fit into uintmax_t, error and force to ull. - Diag(Tok.getLocation(), diag::err_integer_too_large) - << ResultVal.getBitWidth(); + Diag(Tok.getLocation(), diag::err_integer_literal_too_large) + << /* Unsigned */ 1; Ty = Context.UnsignedLongLongTy; assert(Context.getTypeSize(Ty) == ResultVal.getBitWidth() && "long long is not intmax_t?"); @@ -3292,8 +3292,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { // If we still couldn't decide a type, we probably have something that // does not fit in a signed long long, but has no U suffix. if (Ty.isNull()) { - Diag(Tok.getLocation(), diag::ext_integer_too_large_for_signed) - << ResultVal.getBitWidth(); + Diag(Tok.getLocation(), diag::ext_integer_literal_too_large_for_signed); Ty = Context.UnsignedLongLongTy; Width = Context.getTargetInfo().getLongLongWidth(); } |