[cfe-dev] static Matcher generate Use After Free

Artem Dergachev via cfe-dev cfe-dev at lists.llvm.org
Tue Jun 6 02:41:00 PDT 2017


I think i've also noticed that static matcher objects don't work, but 
didn't pay enough attention to figure out why.

In clang-tidy, as far as i understand, they don't use static matchers, 
but instead they have long-lived MatchFinder objects filled with all the 
matchers they need, so they don't need to construct the same matchers 
again and again. Maybe that'd be a viable approach in your case?

06/06/2017 12:15 PM, Aleksandr wrote:
> Hello,
>
> I need help. I see, that using static Matcher generate error on 
> deallocated itself. For example, if we use:
> static StatementMatcher MatcherA = callExpr();
> MatcherA on dealloc tyrying to release reference counter of itself, 
> but reference counter was deleted by method llvm_shutdown, so it use 
> free memory.
> Is it ok? We shouldn't use static matchers, or we have bug in 
> implementation in reference counter. What is it case?




More information about the cfe-dev mailing list