Higuoxing added inline comments.

================
Comment at: test/Sema/parentheses.c:114
+  NON_NESTING_VOID_0(i && i || i); // expected-warning {{'&&' within '||'}} \
+                                   // expected-note {{place parentheses around 
the '&&' expression to silence this warning}}
+  NON_NESTING_VOID_0((i && i) || i); // no warning.
----------------
Higuoxing wrote:
> dexonsmith wrote:
> > Can you add fix-it CHECKs?
> ```
> llvm/tools/clang/test/Sema/parentheses.c:109:15: note: place parentheses 
> around the '&&' expression to silence this warning
>   VOID_CAST(i && i || i); // expected-warning {{'&&' within '||'}} \
>             ~~^~~~
> llvm/tools/clang/test/Sema/parentheses.c:17:34: note: expanded from macro 
> 'VOID_CAST'
> #define VOID_CAST(cond) ( (void)(cond) )
>                                  ^~~~
> ```
> 
> Sorry, it seems that when deal with expressions in macros, there is no fix-it 
> hint ...
The `suggestParentheses` suppress the fix-it hint when the expression is in 
macros

```
  if (ParenRange.getBegin().isFileID() && ParenRange.getEnd().isFileID() &&
      EndLoc.isValid()) {
    Self.Diag(Loc, Note)
      << FixItHint::CreateInsertion(ParenRange.getBegin(), "(")
      << FixItHint::CreateInsertion(EndLoc, ")");
  } else {
    // We can't display the parentheses, so just show the bare note.
    Self.Diag(Loc, Note) << ParenRange;
  }
```

You see, there is a `isFileID()`


https://reviews.llvm.org/D47687



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to