summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/LiteralSupport.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-03-04 22:32:06 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-03-04 22:32:06 +0000
commit560a3579b29a07c729d841acaa1d3371b5fc9b71 (patch)
tree38d1d789e15125216b8b6d846818963a982d51d8 /clang/lib/Lex/LiteralSupport.cpp
parentac92893a93618d66416afbdd86db1ce99543e3e4 (diff)
downloadbcm5719-llvm-560a3579b29a07c729d841acaa1d3371b5fc9b71.tar.gz
bcm5719-llvm-560a3579b29a07c729d841acaa1d3371b5fc9b71.zip
Update diagnostics now that hexadecimal literals look likely to be part of C++17.
llvm-svn: 262753
Diffstat (limited to 'clang/lib/Lex/LiteralSupport.cpp')
-rw-r--r--clang/lib/Lex/LiteralSupport.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index 57494f87433..27c80b93015 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -797,7 +797,8 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
if (!HasSignificandDigits) {
PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s - ThisTokBegin),
- diag::err_hexconstant_requires) << 1;
+ diag::err_hex_constant_requires)
+ << PP.getLangOpts().CPlusPlus << 1;
hadError = true;
return;
}
@@ -821,10 +822,15 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
s = first_non_digit;
if (!PP.getLangOpts().HexFloats)
- PP.Diag(TokLoc, diag::ext_hexconstant_invalid);
+ PP.Diag(TokLoc, PP.getLangOpts().CPlusPlus
+ ? diag::ext_hex_literal_invalid
+ : diag::ext_hex_constant_invalid);
+ else if (PP.getLangOpts().CPlusPlus1z)
+ PP.Diag(TokLoc, diag::warn_cxx1z_hex_literal);
} else if (saw_period) {
- PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-ThisTokBegin),
- diag::err_hexconstant_requires) << 0;
+ PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s - ThisTokBegin),
+ diag::err_hex_constant_requires)
+ << PP.getLangOpts().CPlusPlus << 0;
hadError = true;
}
return;
OpenPOWER on IntegriCloud