Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Checking function parameters!

Wow.   You are awesome guys.

 

Thousands of helps to you.

 

Regards from Mexico,

Felipe

 

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Marc-Andre Laperle
Sent: Friday, July 02, 2010 12:15 PM
To: CDT General developers list.
Subject: Re: [cdt-dev] Checking function parameters!

 

Yup, I've got this working for bug 309760. It also prints the candidates. This one is taking more time, it's becoming the "Whatever-useful-info-IProblemBinding-can-give-us-checker".

On 10-07-02 12:57 PM, Tomasz Wesołowski wrote:

Hello,

No, that won't suffice - the arguments may have different types and still be acceptable due to implicit conversion, like promotion or casting. There are a lot of factors to consider: overloaded conversion operators, non-explicit single-argument constructors, inheritance hierarchy, etc.

Also, getting an IType from IASTDeclaration (well, from IASTDeclSpecifier + IASTDeclarator pair, to be precise, both of which you can get from IASTParameterDeclaration) is non-trivial - maybe it's already designed by someone, but I don't know about that. :)

Probably a lot simpler approach is to use the fact that the Parser generates problem nodes in various erroneous situations, including function calls with bad parameters (with all the logic I mentioned handed correctly) - they're not marked as warnings now, but there's an open bug to create Codan warnings from them.

You may want to examine https://bugs.eclipse.org/bugs/show_bug.cgi?id=309760 .

Best regards,

-- Tomasz Wesołowski



On Fri, Jul 2, 2010 at 5:37 PM, Figuer, Felipe A <Felipe.A.Figuer@xxxxxxxxxx> wrote:

Hello all.  I am currently conceiving how to implement a CODAN checker to report inconsistencies between function call parameter types and function declaration parameter types.

 

Basically I want to check is if the parameters provided match the type declared in the function declaration.

 

My question is as the parameters provided to the function call in the AST are modeled as inherited entities  of IASTExpression

 

Can I rely on getExpressionType() to compare the _expression_ type returned by this method with the declared parameter type no matter what kind of _expression_ I am dealing with?

 

Is this feasible?

 

Thanks in advance for your help and best regards,

 

Felipe Antonio Martinez Figueroa.

+52 442 1030500 Ext.1249.

felipe.a.figuer@xxxxxxxxxx

Delphi Electronics & Safety

Software Development Tools & Expert Synergy User & Suggestions Committee Leader

Queretaro Technical Center.

Circuito Palma Cocotera No. 2059.

Fraccionamiento Palmares.

Queretaro, Qro. CP 76127

Mexico.

****************************************************************************************
Note:  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. 
****************************************************************************************


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



 
 
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev
****************************************************************************************
 
Note:  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. 
 
****************************************************************************************

 

****************************************************************************************

Note:  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. 

****************************************************************************************

Back to the top