vsapsai added a comment.

To preempt some of review feedback here are attempted and rejected approaches:

- Pass `pointerLoc` and `pointerEndLoc` as `pointerRange`. Such source range 
can be misleading as `pointerLoc` doesn't necesserily point at the beginning. 
For example, for `int *x` pointer range would be "*" and I would expect it to 
be "int *". So it's not really a range but 2 related locations.

- Use `D.getDeclSpec().getLocEnd()` instead of 
`D.getDeclSpec().getTypeSpecTypeLoc()`. In this case warning location points at 
the closing angle bracket and that can be confusing to developers. It looks like

  ./test.h:14:3: warning: pointer is missing a nullability type specifier 
(_Nonnull, _Nullable, or _Null_unspecified)
    id<SomeProtocol> thingies;
                   ^



- Use `pointerLoc` for insert note instead of `pointerEndLoc`. It looks like

  ./test.h:14:3: note: insert '_Nullable' if the pointer may be null
    id<SomeProtocol> thingies;
    ^
                     _Nullable

compared to suggested

  ./test.h:14:18: note: insert '_Nullable' if the pointer may be null
    id<SomeProtocol> thingies;
                   ^
                     _Nullable

I don't expect developers to know that they should match whitespace preceding 
_Nullable to calculate where in the line it should be inserted. And I think 
developers shouldn't care about it. So put the cursor where you expect the text 
to be inserted.


https://reviews.llvm.org/D38327



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

Reply via email to