summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2014-05-22 19:56:11 +0000
committerAlexander Kornienko <alexfh@google.com>2014-05-22 19:56:11 +0000
commitd3b4e08960ad6618b4448fd2c0c38c8c4fa6d72b (patch)
tree08dca0c053d8f5455c9c56e6d56e81b30f835e74 /clang/lib/Lex
parentd328db1318f082fae9102df791d41d0231ddbcf4 (diff)
downloadbcm5719-llvm-d3b4e08960ad6618b4448fd2c0c38c8c4fa6d72b.tar.gz
bcm5719-llvm-d3b4e08960ad6618b4448fd2c0c38c8c4fa6d72b.zip
Remove limits on the number of fix-it hints and ranges in the DiagnosticsEngine.
Summary: The limits on the number of fix-it hints and ranges attached to a diagnostic are arbitrary and don't apply universally to all users of the DiagnosticsEngine. The way the limits are enforced may lead to diagnostics generating invalid sets of fixes. I suggest removing the limits, which will also simplify the implementation. Reviewers: rsmith Reviewed By: rsmith Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D3879 llvm-svn: 209468
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/LiteralSupport.cpp3
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp21
2 files changed, 6 insertions, 18 deletions
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index 810d7c28b20..8550198c53f 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -1577,8 +1577,7 @@ bool StringLiteralParser::CopyStringFragment(const Token &Tok,
Dummy.reserve(Fragment.size() * CharByteWidth);
char *Ptr = Dummy.data();
- while (!Builder.hasMaxRanges() &&
- !ConvertUTF8toWide(CharByteWidth, NextFragment, Ptr, ErrorPtrTmp)) {
+ while (!ConvertUTF8toWide(CharByteWidth, NextFragment, Ptr, ErrorPtrTmp)) {
const char *ErrorPtr = reinterpret_cast<const char *>(ErrorPtrTmp);
NextStart = resyncUTF8(ErrorPtr, Fragment.end());
Builder << MakeCharSourceRange(Features, SourceLoc, TokBegin,
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 4278faef708..57bc9468049 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -675,13 +675,8 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName,
DiagnosticBuilder DB =
Diag(MacroName,
diag::note_init_list_at_beginning_of_macro_argument);
- for (SmallVector<SourceRange, 4>::iterator
- Range = InitLists.begin(), RangeEnd = InitLists.end();
- Range != RangeEnd; ++Range) {
- if (DB.hasMaxRanges())
- break;
- DB << *Range;
- }
+ for (const SourceRange &Range : InitLists)
+ DB << Range;
}
return nullptr;
}
@@ -689,15 +684,9 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName,
return nullptr;
DiagnosticBuilder DB = Diag(MacroName, diag::note_suggest_parens_for_macro);
- for (SmallVector<SourceRange, 4>::iterator
- ParenLocation = ParenHints.begin(), ParenEnd = ParenHints.end();
- ParenLocation != ParenEnd; ++ParenLocation) {
- if (DB.hasMaxFixItHints())
- break;
- DB << FixItHint::CreateInsertion(ParenLocation->getBegin(), "(");
- if (DB.hasMaxFixItHints())
- break;
- DB << FixItHint::CreateInsertion(ParenLocation->getEnd(), ")");
+ for (const SourceRange &ParenLocation : ParenHints) {
+ DB << FixItHint::CreateInsertion(ParenLocation.getBegin(), "(");
+ DB << FixItHint::CreateInsertion(ParenLocation.getEnd(), ")");
}
ArgTokens.swap(FixedArgTokens);
NumActuals = FixedNumArgs;
OpenPOWER on IntegriCloud