Submitted by: Bill Wendling

- Chris noticed that if there were multiple warnings/errors expected
  throughout the file and we were checking only one of them, then it
  would go ahead and say that the whole file was okay. Fixed this by
  adding a check for the line number as well as the string.

llvm-svn: 39689
This commit is contained in:
Bill Wendling 2007-06-27 07:43:27 +00:00
parent 87e46687d9
commit a5b3bb11df
1 changed files with 5 additions and 2 deletions

View File

@ -154,12 +154,15 @@ static bool CompareDiagLists(SourceManager &SourceMgr,
DiagList DiffList;
for (const_diag_iterator I = d1_begin, E = d1_end; I != E; ++I) {
unsigned LineNo1 = SourceMgr.getLineNumber(I->first);
const std::string &Diag1 = I->second;
bool Found = false;
for (const_diag_iterator II = d2_begin, IE = d2_end; II != IE; ++II) {
const std::string &Diag2 = II->second;
unsigned LineNo2 = SourceMgr.getLineNumber(II->first);
if (LineNo1 != LineNo2) continue;
const std::string &Diag2 = II->second;
if (Diag2.find(Diag1) != std::string::npos ||
Diag1.find(Diag2) != std::string::npos) {
Found = true;
@ -168,7 +171,7 @@ static bool CompareDiagLists(SourceManager &SourceMgr,
}
if (!Found)
DiffList.push_back(std::make_pair(d1_begin->first, Diag1));
DiffList.push_back(std::make_pair(I->first, Diag1));
}
return PrintProblem(SourceMgr, DiffList.begin(), DiffList.end(), Msg);