[cfe-commits] r129495 - in /cfe/trunk: include/clang/Basic/Diagnostic.h lib/Sema/SemaExpr.cpp

Eli Friedman eli.friedman at gmail.com
Wed Apr 13 17:51:41 PDT 2011


Author: efriedma
Date: Wed Apr 13 19:51:41 2011
New Revision: 129495

URL: http://llvm.org/viewvc/llvm-project?rev=129495&view=rev
Log:
Re-fix r129481 and r129465 properly.  Nulls fixits shouldn't be dropped in
DiagnosticBuilder::AddFixItHint: they will be dropped along with any
other (possibly valid) fixits later.


Modified:
    cfe/trunk/include/clang/Basic/Diagnostic.h
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=129495&r1=129494&r2=129495&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Wed Apr 13 19:51:41 2011
@@ -741,9 +741,6 @@
   }
 
   void AddFixItHint(const FixItHint &Hint) const {
-    if (Hint.isNull())
-      return;
-    
     assert(NumFixItHints < Diagnostic::MaxFixItHints &&
            "Too many fix-it hints!");
     if (DiagObj)

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=129495&r1=129494&r2=129495&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Apr 13 19:51:41 2011
@@ -10092,12 +10092,10 @@
       << 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





More information about the cfe-commits mailing list