[cfe-commits] r86664 - /cfe/trunk/include/clang/Basic/Diagnostic.h

Anders Carlsson andersca at mac.com
Mon Nov 9 20:36:35 PST 2009


Author: andersca
Date: Mon Nov  9 22:36:33 2009
New Revision: 86664

URL: http://llvm.org/viewvc/llvm-project?rev=86664&view=rev
Log:
Don't try to emit null fixit hints.

Modified:
    cfe/trunk/include/clang/Basic/Diagnostic.h

Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=86664&r1=86663&r2=86664&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Mon Nov  9 22:36:33 2009
@@ -105,6 +105,10 @@
   /// modification is known.
   CodeModificationHint() : RemoveRange(), InsertionLoc() { }
 
+  bool isNull() const {
+    return !RemoveRange.isValid() && !InsertionLoc.isValid();
+  }
+  
   /// \brief Create a code modification hint that inserts the given
   /// code string at a specific location.
   static CodeModificationHint CreateInsertion(SourceLocation InsertionLoc,
@@ -586,6 +590,9 @@
   }
 
   void AddCodeModificationHint(const CodeModificationHint &Hint) const {
+    if (Hint.isNull())
+      return;
+    
     assert(NumCodeModificationHints < Diagnostic::MaxCodeModificationHints &&
            "Too many code modification hints!");
     if (DiagObj)





More information about the cfe-commits mailing list