From: Anders Carlsson Date: Tue, 10 Nov 2009 04:36:33 +0000 (+0000) Subject: Don't try to emit null fixit hints. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f019aadc96f8fa3185c684c7150bd596d045064;p=clang Don't try to emit null fixit hints. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86664 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 77a2079b76..16787542eb 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -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)