diff options
Diffstat (limited to 'clang/lib/Format/TokenAnalyzer.cpp')
-rw-r--r-- | clang/lib/Format/TokenAnalyzer.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/lib/Format/TokenAnalyzer.cpp b/clang/lib/Format/TokenAnalyzer.cpp index 89ac35f..7baba62 100644 --- a/clang/lib/Format/TokenAnalyzer.cpp +++ b/clang/lib/Format/TokenAnalyzer.cpp @@ -111,8 +111,8 @@ tooling::Replacements TokenAnalyzer::process() { DEBUG({ llvm::dbgs() << "Replacements for run " << Run << ":\n"; - for (tooling::Replacements::iterator I = RunResult.begin(), - E = RunResult.end(); + for (tooling::Replacements::const_iterator I = RunResult.begin(), + E = RunResult.end(); I != E; ++I) { llvm::dbgs() << I->toString() << "\n"; } @@ -120,7 +120,15 @@ tooling::Replacements TokenAnalyzer::process() { for (unsigned i = 0, e = AnnotatedLines.size(); i != e; ++i) { delete AnnotatedLines[i]; } - Result.insert(RunResult.begin(), RunResult.end()); + for (auto R : RunResult) { + auto Err = Result.add(R); + // FIXME: better error handling here. For now, simply return an empty + // Replacements to indicate failure. + if (Err) { + llvm::errs() << llvm::toString(std::move(Err)) << "\n"; + return tooling::Replacements(); + } + } } return Result; } |