[cfe-commits] r39689 - /cfe/cfe/trunk/Driver/DiagChecker.cpp

bwendlin at cs.uiuc.edu bwendlin at cs.uiuc.edu
Wed Jul 11 09:47:11 PDT 2007


Author: bwendlin
Date: Wed Jul 11 11:47:11 2007
New Revision: 39689

URL: http://llvm.org/viewvc/llvm-project?rev=39689&view=rev
Log:
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.

Modified:
    cfe/cfe/trunk/Driver/DiagChecker.cpp

Modified: cfe/cfe/trunk/Driver/DiagChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Driver/DiagChecker.cpp?rev=39689&r1=39688&r2=39689&view=diff

==============================================================================
--- cfe/cfe/trunk/Driver/DiagChecker.cpp (original)
+++ cfe/cfe/trunk/Driver/DiagChecker.cpp Wed Jul 11 11:47:11 2007
@@ -154,12 +154,15 @@
   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 @@
     }
 
     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);





More information about the cfe-commits mailing list