Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Construct a variable declaration from Literal/Id expression



On Thu, Dec 11, 2014 at 11:17 AM, Krishna Narasimhan <krishna.nm86@xxxxxxxxx> wrote:
That only works if it is a literal _expression_. Even then I need to combine it with getKind to get the real type.  With an ID _expression_, I tend to get something called a ProblemType

getExpressionType works for all expressions. If you get a ProblemType back, something is wrong either with the code or with the AST created from it.

-sergey 


On Thu, Dec 11, 2014 at 8:05 PM, Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> wrote:
See org.eclipse.cdt.core.dom.ast.IASTExpression.getExpressionType() 

On Thu, Dec 11, 2014 at 11:02 AM, Krishna Narasimhan <krishna.nm86@xxxxxxxxx> wrote:

Consider the code

Int x ;
Foo (x)

Now when am analysing foo and the x there. Its type will be idexpression. Now what if i want to know the type of the idexpression. Resolvebindings or getlinkage dont seem to help

On Dec 11, 2014 7:14 PM, "Alena Laskavaia" <elaskavaia.cdt@xxxxxxxxx> wrote:
Its hard to understand what you are talking about. Can you give example of your code?

On Thu, Dec 11, 2014 at 10:37 AM, Krishna Narasimhan <krishna.nm86@xxxxxxxxx> wrote:

Actually i figured out the literalexpression. The issue am having is with the idexpressions. I tried resolvebindings. And getlinkage. Nothing gets me the type.

On Dec 11, 2014 12:16 PM, "Krishna Narasimhan" <krishna.nm86@xxxxxxxxx> wrote:
Hi,
   How do I construct a  variable declaration given a ID or Literal _expression_. Basically, all I need is the type information, so I can use NodeFactory to create a new declSpecifier . 



Regards
       Krishna

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev



--
-----------------------------------------------------
I dare do all that may become a man; Who dares do more, is none - Macbeth, twelfh night!
Regards
       Krishna

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev

Back to the top