]> granicus.if.org Git - clang/commitdiff
Re-fix r129481 and r129465 properly. Nulls fixits shouldn't be dropped in
authorEli Friedman <eli.friedman@gmail.com>
Thu, 14 Apr 2011 00:51:41 +0000 (00:51 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Thu, 14 Apr 2011 00:51:41 +0000 (00:51 +0000)
DiagnosticBuilder::AddFixItHint: they will be dropped along with any
other (possibly valid) fixits later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129495 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/Diagnostic.h
lib/Sema/SemaExpr.cpp

index 3fc60d136b5c40a2eec6075dc78587b243b08fc4..2934632596092f614b8a65b66e245dcbc15fa23a 100644 (file)
@@ -741,9 +741,6 @@ public:
   }
 
   void AddFixItHint(const FixItHint &Hint) const {
-    if (Hint.isNull())
-      return;
-    
     assert(NumFixItHints < Diagnostic::MaxFixItHints &&
            "Too many fix-it hints!");
     if (DiagObj)
index 8ccb9b8180443590aee4f750b42dc31ea12e8c25..b3aaaa2e9e19029bdbe03e8cd30827a11dd77cc1 100644 (file)
@@ -10092,12 +10092,10 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) {
       << FixItHint::CreateReplacement(Loc, "==");
 
   SourceLocation Open = E->getSourceRange().getBegin();
-  SourceLocation Close = E->getSourceRange().getEnd();
-  SourceLocation LocForEndOfToken = 
-    Close.isMacroID() ? Close : PP.getLocForEndOfToken(Close);
+  SourceLocation Close = PP.getLocForEndOfToken(E->getSourceRange().getEnd());
   Diag(Loc, diag::note_condition_assign_silence)
         << FixItHint::CreateInsertion(Open, "(")
-        << FixItHint::CreateInsertion(LocForEndOfToken, ")");
+        << FixItHint::CreateInsertion(Close, ")");
 }
 
 /// \brief Redundant parentheses over an equality comparison can indicate