This is an archive of the discontinued LLVM Phabricator instance.

[ASTMatchers] Ignore parts of BindingDecls which are not spelled in source
ClosedPublic

Authored by steveire on Jan 30 2021, 8:28 AM.

Diff Detail

Event Timeline

steveire requested review of this revision.Jan 30 2021, 8:28 AM
steveire created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 30 2021, 8:28 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaron.ballman added inline comments.Feb 1 2021, 10:29 AM
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
2607

Can you help me to better understand the proposed change? I find this to be surprising behavior -- the thing the user wrote in the source are the binding declarations, the hidden thing they didn't write in the source was the decomposition declaration. e.g., the user introduced some names f, s, and t in the declaration so I would imagine that these *are* spelled in source. What I don't think is necessarily spelled in source is the decomposition declaration for the int[3] to bind to. So I was expecting this to be EXPECT_TRUE instead of EXPECT_FALSE.

steveire added inline comments.Feb 1 2021, 1:06 PM
clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
2607

Can you help me to better understand the proposed change? I find this to be surprising behavior -- the thing the user wrote in the source are the binding declarations, the hidden thing they didn't write in the source was the decomposition declaration. e.g., the user introduced some names f, s, and t in the declaration so I would imagine that these *are* spelled in source. What I don't think is necessarily spelled in source is the decomposition declaration for the int[3] to bind to.

Indeed. The bindingDecl matches, but the has(expr()) part does not, after this change: https://godbolt.org/z/Mqb9Mx

aaron.ballman accepted this revision.Feb 2 2021, 5:27 AM

LGTM!

clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
2607

The test changes nicely clarify what's going on, thank you.

This revision is now accepted and ready to land.Feb 2 2021, 5:27 AM
This revision was landed with ongoing or failed builds.Feb 2 2021, 6:23 AM
This revision was automatically updated to reflect the committed changes.