[llvm-branch-commits] [cfe-branch] r125035 - in /cfe/branches/Apple/sill: lib/Basic/Diagnostic.cpp tools/c-index-test/c-index-test.c

Daniel Dunbar daniel at zuster.org
Mon Feb 7 11:59:48 PST 2011


Author: ddunbar
Date: Mon Feb  7 13:59:48 2011
New Revision: 125035

URL: http://llvm.org/viewvc/llvm-project?rev=125035&view=rev
Log:
Merge r124833:
--
Author: Douglas Gregor <dgregor at apple.com>
Date:   Thu Feb 3 23:41:12 2011 +0000

    If any Fix-Its attached to a diagnostic have invalid source locations
    or source locations that refer into a macro instantiation, delete all
    of the Fix-Its on that diagnostic.

*** CUSTOM MERGE ***

Modified:
    cfe/branches/Apple/sill/lib/Basic/Diagnostic.cpp
    cfe/branches/Apple/sill/tools/c-index-test/c-index-test.c

Modified: cfe/branches/Apple/sill/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/sill/lib/Basic/Diagnostic.cpp?rev=125035&r1=125034&r2=125035&view=diff
==============================================================================
--- cfe/branches/Apple/sill/lib/Basic/Diagnostic.cpp (original)
+++ cfe/branches/Apple/sill/lib/Basic/Diagnostic.cpp Mon Feb  7 13:59:48 2011
@@ -613,6 +613,19 @@
       SetDelayedDiagnostic(diag::fatal_too_many_errors);
   }
 
+  // If we have any Fix-Its, make sure that all of the Fix-Its point into
+  // source locations that aren't macro instantiations. If any point into
+  // macro instantiations, remove all of the Fix-Its.
+  for (unsigned I = 0, N = NumFixItHints; I != N; ++I) {
+    const FixItHint &FixIt = FixItHints[I];
+    if (FixIt.RemoveRange.isInvalid() ||
+        FixIt.RemoveRange.getBegin().isMacroID() ||
+        FixIt.RemoveRange.getEnd().isMacroID()) {
+      NumFixItHints = 0;
+      break;
+    }    
+  }
+  
   // Finally, report it.
   Client->HandleDiagnostic(DiagLevel, Info);
   if (Client->IncludeInDiagnosticCounts()) {

Modified: cfe/branches/Apple/sill/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/sill/tools/c-index-test/c-index-test.c?rev=125035&r1=125034&r2=125035&view=diff
==============================================================================
--- cfe/branches/Apple/sill/tools/c-index-test/c-index-test.c (original)
+++ cfe/branches/Apple/sill/tools/c-index-test/c-index-test.c Mon Feb  7 13:59:48 2011
@@ -677,7 +677,7 @@
   Idx = clang_createIndex(/* excludeDeclsFromPCH */
                           (!strcmp(filter, "local") || 
                            !strcmp(filter, "local-display"))? 1 : 0,
-                          /* displayDiagnosics=*/1);
+                          /* displayDiagnosics=*/0);
 
   if (parse_remapped_files(argc, argv, 0, &unsaved_files, &num_unsaved_files)) {
     clang_disposeIndex(Idx);





More information about the llvm-branch-commits mailing list