<div class="gmail_extra"><div class="gmail_quote">On Fri, Sep 7, 2012 at 8:06 AM, Daniel Jasper <span dir="ltr"><<a href="mailto:reviews@llvm-reviews.chandlerc.com" target="_blank" class="cremed">reviews@llvm-reviews.chandlerc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi klimek,<br>
<br>
Change the behavior of the isDerivedFrom-matcher to not match on the class itself. This caused some confusion (intuitively, a class is not derived from itself) and makes it hard to write certain matchers, e.g. "match and bind any pair of base and subclass".<br>
<br>
The original behavior can be achieved with a new isA-matcher. Similar to all other matchers, this matcher has the same behavior and name as the corresponding AST-entity - in this case the isa<>() function.<br></blockquote>
<div><br></div><div>This is not a new idea. In fact, when we first built the isDerivedFrom matcher over a year ago Manuel and others argued for what you propose. I argued firmly against it, and my feelings have not changed. Manuel should have remembered that.</div>
<div><br></div><div>See Sebastien Redl's comment for why I firmly believe that the current behavior is the correct behavior: std::is_base_of behaves the exact same way.</div><div><br></div><div>I don't see why "math and bind any pair of base and subclass" is that hard to write. It only requires a not matcher that tests for type equality. Can you give an example that is hard to write, and maybe there is a better way to write it?</div>
<div><br></div><div>I also strongly object to the name "isA" as a matcher. We already have an "isa<..>()" utility within LLVM and Clang that is extremely widely used. I *do not want* a case-difference to select between the two in any circumstance. And again, I raised this objection when the idea was first proposed over a year ago.</div>
<div><br></div><div>So, let's discuss the actual problems with writing matchers, and see if we can find solutions for them?</div><div><br></div><div>-Chandler</div><div><br></div><div>PS: Just to be clear, I claim that the AST matchers are currently in the exact same situation as any other C++ interfaces in Clang. While we should not gratuitously break out-of-tree code, we should continue to feel free to change the API in backwards incompatible ways, and document these changes to help people with out-of-tree code update to match. So, I'm not worried about that aspect of this patch. =]</div>
</div></div>