summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2017-05-24 22:18:35 +0000
committerTim Northover <tnorthover@apple.com>2017-05-24 22:18:35 +0000
commit9d891185ad51c12a9051801464ca95fcb7633c7e (patch)
treea893be8d2c5c20cdc74fec0d1514a624dc4359d6 /clang/lib/Lex
parenta28414d7ec3d86c23d4aaf39ca71f67634ae4a04 (diff)
downloadbcm5719-llvm-9d891185ad51c12a9051801464ca95fcb7633c7e.tar.gz
bcm5719-llvm-9d891185ad51c12a9051801464ca95fcb7633c7e.zip
Revert "Sema: allow imaginary constants via GNU extension if UDL overloads not present."
This reverts commit r303697. It broke libc++ tests that were specifically checking incompatibility in C++14 mode. llvm-svn: 303813
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/LiteralSupport.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index 1fead55e80f..1e2cbde825f 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -651,6 +651,9 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling,
break;
}
}
+ // "i", "if", and "il" are user-defined suffixes in C++1y.
+ if (*s == 'i' && PP.getLangOpts().CPlusPlus14)
+ break;
// fall through.
case 'j':
case 'J':
@@ -662,34 +665,35 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling,
break;
}
- // "i", "if", and "il" are user-defined suffixes in C++1y.
- if (s != ThisTokEnd || isImaginary) {
+ if (s != ThisTokEnd) {
// FIXME: Don't bother expanding UCNs if !tok.hasUCN().
expandUCNs(UDSuffixBuf, StringRef(SuffixBegin, ThisTokEnd - SuffixBegin));
if (isValidUDSuffix(PP.getLangOpts(), UDSuffixBuf)) {
- if (!isImaginary) {
- // Any suffix pieces we might have parsed are actually part of the
- // ud-suffix.
- isLong = false;
- isUnsigned = false;
- isLongLong = false;
- isFloat = false;
- isHalf = false;
- isImaginary = false;
- MicrosoftInteger = 0;
- }
+ // Any suffix pieces we might have parsed are actually part of the
+ // ud-suffix.
+ isLong = false;
+ isUnsigned = false;
+ isLongLong = false;
+ isFloat = false;
+ isHalf = false;
+ isImaginary = false;
+ MicrosoftInteger = 0;
saw_ud_suffix = true;
return;
}
- if (s != ThisTokEnd) {
- // Report an error if there are any.
- PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, SuffixBegin - ThisTokBegin),
- diag::err_invalid_suffix_constant)
- << StringRef(SuffixBegin, ThisTokEnd - SuffixBegin) << isFPConstant;
- hadError = true;
- }
+ // Report an error if there are any.
+ PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, SuffixBegin - ThisTokBegin),
+ diag::err_invalid_suffix_constant)
+ << StringRef(SuffixBegin, ThisTokEnd-SuffixBegin) << isFPConstant;
+ hadError = true;
+ return;
+ }
+
+ if (isImaginary) {
+ PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, SuffixBegin - ThisTokBegin),
+ diag::ext_imaginary_constant);
}
}
OpenPOWER on IntegriCloud