diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-04 16:12:48 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-04 16:12:48 +0000 |
| commit | 0883ccd9eac3b974df00e6548ee319a7dd3646f4 (patch) | |
| tree | d6a70c3518b8dea8be7062438d7e8676820ed17f /lib/Lex/LiteralSupport.cpp | |
| parent | 60bfabcd8ce617297c0d231f77d14ab507e98796 (diff) | |
Notes
Diffstat (limited to 'lib/Lex/LiteralSupport.cpp')
| -rw-r--r-- | lib/Lex/LiteralSupport.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp index 1cfa0e374506..f4255822641d 100644 --- a/lib/Lex/LiteralSupport.cpp +++ b/lib/Lex/LiteralSupport.cpp @@ -654,6 +654,7 @@ CharLiteralParser::CharLiteralParser(const char *begin, const char *end, llvm::APInt LitVal(PP.getTargetInfo().getIntWidth(), 0); unsigned NumCharsSoFar = 0; + bool Warned = false; while (begin[0] != '\'') { uint64_t ResultChar; if (begin[0] != '\\') // If this is a normal character, consume it. @@ -670,8 +671,10 @@ CharLiteralParser::CharLiteralParser(const char *begin, const char *end, } else { // Narrow character literals act as though their value is concatenated // in this implementation, but warn on overflow. - if (LitVal.countLeadingZeros() < 8) + if (LitVal.countLeadingZeros() < 8 && !Warned) { PP.Diag(Loc, diag::warn_char_constant_too_large); + Warned = true; + } LitVal <<= 8; } } |
