[cfe-commits] r129481 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/FixIt/no-macro-fixit.c

Fariborz Jahanian fjahanian at apple.com
Wed Apr 13 15:18:38 PDT 2011


Author: fjahanian
Date: Wed Apr 13 17:18:37 2011
New Revision: 129481

URL: http://llvm.org/viewvc/llvm-project?rev=129481&view=rev
Log:
Issue the 2nd fixit even if fix-it hint is supressed.
// rdar://9091893

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/FixIt/no-macro-fixit.c

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=129481&r1=129480&r2=129481&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Apr 13 17:18:37 2011
@@ -10081,12 +10081,11 @@
 
   SourceLocation Open = E->getSourceRange().getBegin();
   SourceLocation Close = E->getSourceRange().getEnd();
-  if (!Open.isMacroID() && !Close.isMacroID()) {
-    SourceLocation LocForEndOfToken = PP.getLocForEndOfToken(Close);
-    Diag(Loc, diag::note_condition_assign_silence)
-      << FixItHint::CreateInsertion(Open, "(")
-      << FixItHint::CreateInsertion(LocForEndOfToken, ")");
-  }
+  SourceLocation LocForEndOfToken = 
+    Close.isMacroID() ? Close : PP.getLocForEndOfToken(Close);
+  Diag(Loc, diag::note_condition_assign_silence)
+        << FixItHint::CreateInsertion(Open, "(")
+        << FixItHint::CreateInsertion(LocForEndOfToken, ")");
 }
 
 /// \brief Redundant parentheses over an equality comparison can indicate

Modified: cfe/trunk/test/FixIt/no-macro-fixit.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/no-macro-fixit.c?rev=129481&r1=129480&r2=129481&view=diff
==============================================================================
--- cfe/trunk/test/FixIt/no-macro-fixit.c (original)
+++ cfe/trunk/test/FixIt/no-macro-fixit.c Wed Apr 13 17:18:37 2011
@@ -10,6 +10,7 @@
     int value;
 
     while (value = va_arg(values, int)) {  // expected-warning {{using the result of an assignment as a condition without parentheses}} \
-                                           // expected-note {{use '==' to turn this assignment into an equality comparison}}
+                                           // expected-note {{use '==' to turn this assignment into an equality comparison}} \
+					   // expected-note {{place parentheses around the assignment to silence this warning}}
     }
 }





More information about the cfe-commits mailing list