This is an archive of the discontinued LLVM Phabricator instance.

[ASTMatchers] The `isInline` matcher now accepts inline variables
AbandonedPublic

Authored by Izaron on Feb 3 2022, 9:22 AM.

Details

Summary

Inline variables is a feature from C++17. It makes sense
to extend the isInline matcher in order to support corresponding varDecls.

Diff Detail

Event Timeline

Izaron requested review of this revision.Feb 3 2022, 9:22 AM
Izaron created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2022, 9:22 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Izaron added a comment.Feb 3 2022, 9:24 AM

I am planning to reuse this matcher in my new checker (https://reviews.llvm.org/D118743, under development now), removing this line:

AST_MATCHER(VarDecl, isVarInline) { return Node.isInline(); }

P.S. If this review is eventually approved, kindly please merge the commit on my behalf =) As I don't have merge access. My name is Evgeny Shulgin and email is izaronplatz@gmail.com. Sorry for inconvenience!

Izaron added inline comments.Feb 3 2022, 9:27 AM
clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp
195–201

Isn't this test equivalent to the new one I wrote in the other file? The difference between TEST and TEST_P I see is that the latter one allows you to check C++17 code, while the former does not. So I decided to have all checks in one place.

I had the same idea in D118900

Izaron abandoned this revision.Feb 4 2022, 10:21 AM

I had the same idea in D118900

Wow! That's a curious coincidence. I'm closing my PR =) Let it be your version as the earlier one.