[cfe-commits] r58817 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ include/clang/Parse/ lib/AST/ lib/Basic/ lib/Parse/ lib/Sema/ test/SemaCXX/ www/

Sebastian Redl sebastian.redl at getdesigned.at
Mon Nov 10 08:36:33 PST 2008


Doug Gregor wrote:
> On Fri, Nov 7, 2008 at 5:53 PM, Sebastian Redl
> <sebastian.redl at getdesigned.at> wrote:
>   
>   
>>> +
>>> +#ifndef OVERLOADED_OPERATOR
>>> +#  define OVERLOADED_OPERATOR(Name,Spelling,Token)
>>> +#endif
>>>
>>>       
>> Wouldn't it make more sense to put an #error directive here? Surely
>> including a .def file without defining those macros cannot be intentional.
>>     
>
> One might want to pull out just the multi-token operators, so I made
> that option easy.
>   
OK, makes sense.
>   
>>> +IdentifierInfo *Parser::MaybeParseOperatorFunctionId() {
>>> +  if (Tok.isNot(tok::kw_operator))
>>> +    return 0;
>>> +
>>> +  OverloadedOperatorKind Op = OO_None;
>>> +  switch (NextToken().getKind()) {
>>>
>>>       
>> Hmm ... I know very little about how Clang's parser works, but wouldn't it
>> be easier to just consume the operator keyword no matter what? What's the
>> use case of leaving it in there? (Obviously, the part that parses a
>> conversion operator would have to be adapted.)
>>     
>
> If the token after the 'operator' does not start an
> operator-function-id, we don't parse the 'operator'. Instead, we end
> up parsing a conversion-function-id, which consumes the 'operator'.
>   
Well, the conversion-function-id could simply not consume the 'operator'.

Sebastian




More information about the cfe-commits mailing list