It would be great, to mark it as a temporary or internal solution. However for example there are several autotest using asString, in this case it would be great, to use it as little as possible.<br><br><div class="gmail_quote">
On 8 October 2012 14:17, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Mon, Oct 8, 2012 at 2:12 PM, Daniel Jasper <<a href="mailto:djasper@google.com">djasper@google.com</a>> wrote:<br>
> +cfe-dev<br>
><br>
</div><div class="im">> The const-case was just an example. You have similar problems with<br>
> arrays, pointers, references (where to put [], * and &? where to put<br>
> spaces?), types with typedefs, ...<br>
><br>
> I am working on a sensible way to match types (see<br>
> <a href="http://llvm-reviews.chandlerc.com/D47" target="_blank">http://llvm-reviews.chandlerc.com/D47</a>), which will enable better Type<br>
> matching. The AST-matcher language is a good way to describe patterns<br>
> in the AST and we don't want a second language based on strings. Thus,<br>
> I am  against extending the functionality of asString in any way.<br>
<br>
</div>That about sums up what I think, too. Perhaps we should give asString<br>
a name that makes it clear that we're basically relying on a volatile<br>
concept? asDebugString? asInternalStringDump?<br>
<br>
Cheers,<br>
/Manuel<br>
<div><div class="h5"><br>
><br>
> On Mon, Oct 8, 2012 at 2:06 PM, Gábor Horváth <<a href="mailto:xazax.hun@gmail.com">xazax.hun@gmail.com</a>> wrote:<br>
>> What about forcing asString to only match unqualified types, and force users<br>
>> to use isConstqualified and other matchers for qualifiers together with<br>
>> asString? If asString would match both the cannonical types and typedefs,<br>
>> and ignored qualifiers, would it cause any problem? It sounds considerably<br>
>> user friendly for me.<br>
>><br>
>><br>
>> On 8 October 2012 10:31, Daniel Jasper <<a href="mailto:djasper@google.com">djasper@google.com</a>> wrote:<br>
>>><br>
>>> We actually had a longish discussion whether we wanted to have the<br>
>>> asString-matcher at all. The problem is that there is no canonical way<br>
>>> to convert a Type to a string. As an easy example, you could write in<br>
>>> the code "const int a;" or "int const a;" and asString() would always<br>
>>> give you "const int" (or the other, but where can you look that up?).<br>
>>> We decided on including it simply wrapping QualType::asString() just<br>
>>> because it is very convenient in some places. I don't see an easy way<br>
>>> of making this a good general purpose user interface.<br>
>>><br>
>>> On Sun, Oct 7, 2012 at 10:38 PM, Gábor Horváth <<a href="mailto:xazax.hun@gmail.com">xazax.hun@gmail.com</a>><br>
>>> wrote:<br>
>>> > Hi!<br>
>>> ><br>
>>> > With "_Bool" it works flawlessly thanks. I wonder if isBoolean is an<br>
>>> > user<br>
>>> > friendly solution, as one might except to use asString with any type.<br>
>>> > However I admint, making asString matcher able to match everything might<br>
>>> > add<br>
>>> > unnecessary complexity.<br>
>>> ><br>
>>> > Thanks,<br>
>>> > Gábor<br>
>>> ><br>
>>> ><br>
>>> > On 7 October 2012 22:21, Daniel Jasper <<a href="mailto:djasper@google.com">djasper@google.com</a>> wrote:<br>
>>> >><br>
>>> >> +cfe-dev<br>
>>> >><br>
>>> >> Hi Gábor,<br>
>>> >><br>
>>> >> I think the AST-internal-name of the type bool is '_Bool'. Can you try<br>
>>> >> that with the asString-matcher? However, I think the right solution<br>
>>> >> would be to write a matcher like:<br>
>>> >><br>
>>> >> AST_MATCHER(QualType, isBoolean) {<br>
>>> >>   return Node->isBooleanType();<br>
>>> >> }<br>
>>> >><br>
>>> >> Cheers,<br>
>>> >> Daniel<br>
>>> >><br>
>>> >> On Sun, Oct 7, 2012 at 10:06 PM, Gábor Horváth <<a href="mailto:xazax.hun@gmail.com">xazax.hun@gmail.com</a>><br>
>>> >> wrote:<br>
>>> >> > Hi!<br>
>>> >> ><br>
>>> >> > I can't figure out how can I match bool types.<br>
>>> >> ><br>
>>> >> > First of all, I had a matcher like this:<br>
>>> >> ><br>
>>> >> ><br>
>>> >> > classTemplateSpecializationDecl(hasAnyTemplateArgument(refersToType(asString("bool"))))<br>
>>> >> ><br>
>>> >> > but asString("bool") did not give me any match, however using any<br>
>>> >> > other<br>
>>> >> > types would. First of all, I thought, maybe bool is a typedef, and<br>
>>> >> > that<br>
>>> >> > can<br>
>>> >> > cause the problem, so I alstered the asString matcher, to also check<br>
>>> >> > the<br>
>>> >> > name of the cannonical type.<br>
>>> >> ><br>
>>> >> > It looks now like this one:<br>
>>> >> > AST_MATCHER_P(QualType, asString, std::string, Name) {<br>
>>> >> >   return Name == Node.getAsString() || Name ==<br>
>>> >> > Node.getCanonicalType().getAsString();<br>
>>> >> > }<br>
>>> >> ><br>
>>> >> > However I still has no success.<br>
>>> >> ><br>
>>> >> > Thanks for your answer in advance,<br>
>>> >> > Gábor<br>
>>> ><br>
>>> ><br>
>><br>
>><br>
><br>
</div></div>> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br>