[Qt-creator] Clang based code model

Pawel pawelfaron87 at wp.pl
Sat Feb 15 10:30:04 CET 2014


Thanks Konstantin for your response :)

I though that if this is valid C syntax then Clang should support it. If  
this won't influence the parser performance and memory usage significantly  
then maybe we should consider to add it?

best regards
Pawel

On Sat, 15 Feb 2014 09:02:11 +0100, Konstantin Tokarev <annulen at yandex.ru>  
wrote:

>
>
> 14.02.2014, 23:57, "Pawel" <pawelfaron87 at wp.pl>:
>> Hello,
>>
>> I've tried the Clang code model and unfortunately found out that it
>> doesn't support the old K&R style function parameter declarations like
>> this:
>>
>> int func(a, b, c)
>>     int a;
>>     int b;
>>     int c;
>> {
>>    return a + b + c;
>> }
>>
>> You may not believe there are still people who use it... and almost  
>> every
>> IDE is at lost with it :) Do you think that there is anything that can  
>> be
>> done with it?
>
> clang compiler parses this code just fine, so it should be possible to  
> fix.
>
> $ clang -cc1 -ast-dump knr_params.c
> TranslationUnitDecl 0x200cf70 <<invalid sloc>>
> |-TypedefDecl 0x200d240 <<invalid sloc>> __builtin_va_list 'char *'
> `-FunctionDecl 0x200d380 <knr_params.c:1:1, line:7:1> func 'int (int,  
> int, int)'
>   |-ParmVarDecl 0x200d280 <line:2:5, col:9> a 'int'
>   |-ParmVarDecl 0x200d2c0 <line:3:5, col:9> b 'int'
>   |-ParmVarDecl 0x200d300 <line:4:5, col:9> c 'int'
>   `-CompoundStmt 0x200d4a8 <line:5:1, line:7:1>
>     `-ReturnStmt 0x200d498 <line:6:4, col:19>
>       `-BinaryOperator 0x200d480 <col:11, col:19> 'int' '+'
>         |-BinaryOperator 0x200d440 <col:11, col:15> 'int' '+'
>         | |-ImplicitCastExpr 0x200d420 <col:11> 'int' <LValueToRValue>
>         | | `-DeclRefExpr 0x200d3ec <col:11> 'int' lvalue ParmVar  
> 0x200d280 'a' 'int'
>         | `-ImplicitCastExpr 0x200d430 <col:15> 'int' <LValueToRValue>
>         |   `-DeclRefExpr 0x200d404 <col:15> 'int' lvalue ParmVar  
> 0x200d2c0 'b' 'int'
>         `-ImplicitCastExpr 0x200d470 <col:19> 'int' <LValueToRValue>
>           `-DeclRefExpr 0x200d458 <col:19> 'int' lvalue ParmVar  
> 0x200d300 'c' 'int'
>
>
> Regards,
> Konstantin
>


-- 
Using Opera's mail client: http://www.opera.com/mail/

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com




More information about the Qt-creator mailing list