[PATCH] D63222: [Clangd] Fixed clangd diagnostics priority
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 13 03:36:50 PDT 2019
kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.
LGTM, thanks!
Also please make sure you've clang-formatted the code before you land this.
================
Comment at: clang-tools-extra/clangd/Diagnostics.cpp:94
}
llvm::Optional<Range> FallbackRange;
// The range may be given as a fixit hint instead.
----------------
`FallbackRange` is not returned anymore, you can safely delete it.
================
Comment at: clang-tools-extra/clangd/Diagnostics.cpp:110
+ Token Tok;
+ if(!Lexer::getRawToken(Loc, Tok, M, L, true)) {
+ bool IsTokenComment = Tok.isNot(tok::comment);
----------------
I think you can simply it further by:
```
// Fallback to zero-width range at diagnostic location.
auto R = CharSourceRange::getCharRange(Loc);
Token Tok;
// For non-comment tokens, use token at the location.
if (!Lexer::getRawToken(Loc, Tok, M, L, true) && Tok.isNot(tok::comment))
R = CharSourceRange::getTokenRange(Tok.getLocation(), Tok.getEndLoc());
return halfOpenToRange(M, R);
```
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63222/new/
https://reviews.llvm.org/D63222
More information about the cfe-commits
mailing list