v.g.vassilev added inline comments.

================
Comment at: lib/Sema/SemaInit.cpp:892
+      SpellingLoc = SemaRef.getSourceManager().getSpellingLoc(SpellingLoc);
+      if (!(SpellingLoc.isValid() && 
+            SemaRef.getSourceManager().isInSystemHeader(SpellingLoc))) {
----------------
yamaguchi wrote:
> v.g.vassilev wrote:
> > I'd avoid double negations. Could you use `isInvalid` instead of 
> > `!isValid`. That would make the condition more readable.
> It's not (!SpellingLoc.isValid()) but is !((SpellingLoc.isValid() &&         
> SemaRef.getSourceManager().isInSystemHeader(SpellingLoc))
> 
I'd rewrite this using early returns:
```
if (SpellingLoc.isInvalid() || 
SemaRef.getSourceManager().isInSystemHeader(SpellingLoc))
  return;
...
```


https://reviews.llvm.org/D32646



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

Reply via email to