Page MenuHomePhabricator

[clangd] NFC: Prefer `isa<>` to `dyn_cast<>` to do the checking.
ClosedPublic

Authored by MTC on Nov 25 2018, 6:42 AM.

Event Timeline

MTC created this revision.Nov 25 2018, 6:42 AM
MaskRay accepted this revision.Nov 25 2018, 4:43 PM
MaskRay added inline comments.
clangd/AST.cpp
98

isa<NamespaceDecl>(ND) also works.

This revision is now accepted and ready to land.Nov 25 2018, 4:43 PM
MTC marked an inline comment as done.Nov 25 2018, 7:10 PM
MTC added inline comments.
clangd/AST.cpp
98

Thanks for the tips! I will update it latter.

ilya-biryukov accepted this revision.Nov 26 2018, 2:54 AM

Ah, sorry, landed a cleanup fixing the warnings (rL347539) before seeing this change.
But given that isa<> are still better than dyn_cast<>, this change might still be worth landing.

MTC updated this revision to Diff 175232.Nov 26 2018, 5:35 AM

Use more concise form.

MTC retitled this revision from [clangd] NFC: Eliminate the unused variable warning. to [clangd] NFC: Prefer `isa<>` to `dyn_cast<>` to do the checking..Nov 26 2018, 5:42 AM
MTC edited the summary of this revision. (Show Details)
MTC added a comment.EditedNov 26 2018, 5:51 AM

But given that isa<> are still better than dyn_cast<>, this change might still be worth landing.

We can land this change this time or do the cleaning job in other patches in the future, it's all up to you guys, the active clangd contributors :).

In D54878#1307845, @MTC wrote:

We can land this change this time or do the cleaning job in other patches in the future, it's all up to you guys, the active clangd contributors :).

Please land this, it's a useful cleanup.
Unless you'd prefer to not spend any more time on this, in which case I'd just land it for you :-)

This revision was automatically updated to reflect the committed changes.