This is an archive of the discontinued LLVM Phabricator instance.

ASTMatchers: Implement hasNextSibling()
AbandonedPublic

Authored by klimek on Aug 28 2014, 9:33 AM.

Details

Summary

In order to implement the static analyzer check in D5042 using ASTMatchers, I need the concept of a hasNextSibling() constraint.

The attached patch does not compile, but I'm wondering if I'm in the ballpark as far as implementation goes, or whether there is a better way to do this. (See the FIXME comments in the patch for what's not implemented.)

Also, it may make more sense to implement this as hasNextStatement() instead of a more generic "hasNextSibling()" because what I really want to match the next statement after the one I matched.

Diff Detail

Event Timeline

ddkilzer updated this revision to Diff 13043.Aug 28 2014, 9:33 AM
ddkilzer retitled this revision from to ASTMatchers: Implement hasNextSibling().
ddkilzer updated this object.
ddkilzer edited the test plan for this revision. (Show Details)
ddkilzer added reviewers: klimek, krememek, jordan_rose.
ddkilzer added a subscriber: Unknown Object (MLST).
ddkilzer updated this object.Aug 28 2014, 9:35 AM
klimek edited edge metadata.Aug 31 2014, 6:09 AM

I don't think using the AST directly for control flow is something that will always work. The static analyzer builds a CFG for that reason.

klimek commandeered this revision.Sep 8 2014, 3:05 AM
klimek abandoned this revision.
klimek edited reviewers, added: ddkilzer; removed: klimek.