]> granicus.if.org Git - clang/commitdiff
Don't try to emit null fixit hints.
authorAnders Carlsson <andersca@mac.com>
Tue, 10 Nov 2009 04:36:33 +0000 (04:36 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 10 Nov 2009 04:36:33 +0000 (04:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86664 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/Diagnostic.h

index 77a2079b766da17f2a9714474d9969b5a4d84233..16787542eb283ce1fc800ceaedc690a43224a9c2 100644 (file)
@@ -105,6 +105,10 @@ public:
   /// 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 @@ public:
   }
 
   void AddCodeModificationHint(const CodeModificationHint &Hint) const {
+    if (Hint.isNull())
+      return;
+    
     assert(NumCodeModificationHints < Diagnostic::MaxCodeModificationHints &&
            "Too many code modification hints!");
     if (DiagObj)