This is an archive of the discontinued LLVM Phabricator instance.

[ASTMatchers] Output currently matching node on crash
ClosedPublic

Authored by njames93 on Mar 26 2022, 8:56 AM.

Details

Summary

Extend D120185 to also log the node being matched on in case of a crash.
This can help if a matcher is causing a crash or there are not enough interesting nodes bound.

Diff Detail

Event Timeline

njames93 created this revision.Mar 26 2022, 8:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 26 2022, 8:56 AM
njames93 requested review of this revision.Mar 26 2022, 8:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 26 2022, 8:56 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
njames93 updated this revision to Diff 418473.Mar 27 2022, 3:28 PM

Update tests.

This revision is now accepted and ready to land.Mar 28 2022, 2:34 PM
This revision was automatically updated to reflect the committed changes.
njames93 reopened this revision.Apr 1 2022, 1:20 AM
This revision is now accepted and ready to land.Apr 1 2022, 1:20 AM
njames93 updated this revision to Diff 419662.Apr 1 2022, 1:21 AM

Split PointerUnion to work on 32bit platforms

njames93 requested review of this revision.Apr 1 2022, 1:22 AM
njames93 updated this revision to Diff 419690.Apr 1 2022, 2:46 AM

Use macro to reduce duplication

aaron.ballman accepted this revision.Apr 1 2022, 5:45 AM

This looks.... good?.... to me. :-)

Despite this complicating things by a fair amount, I don't have a better suggestion to offer. LGTM

clang/lib/ASTMatchers/ASTMatchFinder.cpp
771
This revision is now accepted and ready to land.Apr 1 2022, 5:45 AM

This looks.... good?.... to me. :-)

Despite this complicating things by a fair amount, I don't have a better suggestion to offer. LGTM

This was the "nicest" cheapest way I could think to implement this, It's also why I thought it best to resubmit this for review.
Annoyingly this is now suboptimal for 64bit code, but I'm not sure it's worth writing 2 implementations for 64 and 32 bit.

This looks.... good?.... to me. :-)

Despite this complicating things by a fair amount, I don't have a better suggestion to offer. LGTM

This was the "nicest" cheapest way I could think to implement this, It's also why I thought it best to resubmit this for review.
Annoyingly this is now suboptimal for 64bit code, but I'm not sure it's worth writing 2 implementations for 64 and 32 bit.

Given that it has to do with crash analysis (which had better not be performance sensitive!!), I think I agree it's not worth writing two implementations for this.

This looks.... good?.... to me. :-)

Despite this complicating things by a fair amount, I don't have a better suggestion to offer. LGTM

(sorry to turn up a year later, just want to see if I'm missing something)

AFAICT there's only ever one CurMatchData object.
In which case squeezing the union discriminator into the low bits saves... 8 bytes of stack over the whole AST traversal.

I ran into this when I tried to add a ninth pointer type. We could use a second bit of the callback, but seems like we can just store the discriminator in an int instead?