[PATCH] D116022: [clang][dataflow] Add support for terminating virtual destructors

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 21 13:14:16 PST 2021

xazax.hun added a comment.

In D116022#3205478 <https://reviews.llvm.org/D116022#3205478>, @gribozavr2 wrote:

>> How resilient is this pattern matching?
> Possibly it is not very robust. However it is very important for a certain style of precondition verification macros used by various Google projects. I can't find an exact open source copy, but they are generally similar to this one, but usually use a ternary instead of an if statement:
> https://source.chromium.org/chromium/chromium/src/+/main:third_party/re2/src/util/logging.h
> Also similar to this one, but with an object that has a noreturn destructor instead of inline assembly that causes a trap:
> https://source.chromium.org/chromium/chromium/src/+/main:base/check.h
> If it wasn't for this "curious" coding pattern that is stamped into many function thanks to the macro, we wouldn't be bothering with this pattern matching at this point.

I see. This makes sense as a temporary workaround, but in the long term I'd love to see a more general solution. I'm ok with this as is, but I'd love to see more tests that (possibly) does not provide the expected results along some TODOs and some comments about the specific coding patterns this is targeting.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list