Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Getting ITranslationUnit from IASTTranslationUnit

I ended up adding IASTTranslationUnit.getOriginatingTranslationUnit() method. I decided against the adapter approach since a call to getAdapter could inadvertently load the ITranslationUnit class.

-sergey

On Thu, Mar 10, 2011 at 2:03 PM, Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> wrote:
Declaring of an ITranslationUnit field and a getter for that field does not cause loading of ITranslationUnit class until the method is called.

-sergey

On Tue, Mar 8, 2011 at 12:25 PM, Chris Recoskie <recoskie@xxxxxxxxxx> wrote:

I see your point. However, if you create new methods on IASTTranslationUnit that return ITranslationUnit, then there will be a runtime dependency on ITranslationUnit, even if you never call it. That's my concern.

What if, for example, the IASTTranslationUnit could get/set a String workspace path, and also had a boolean get/set for a flag that indicates if it came from the working copy? Would that satisfy your needs? There would be no new dependencies then. You would have to add/change API though to pass on down the path and the flag, but you will be into that anyway if you wanted to pass in the ITranslationUnit because the calls that actually create the IASTTranslation unit are buried pretty deep in the call chain.



===========================
Chris Recoskie
Team Lead, IBM CDT and RDT
IBM Toronto

Inactive hide details for Sergey Prigogin ---03/08/2011 01:56:12 PM---I'm not proposing making ITranslationUnit a requirement fSergey Prigogin ---03/08/2011 01:56:12 PM---I'm not proposing making ITranslationUnit a requirement for creation of IASTTranslationUnit. In case


From:

Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx>

To:

"CDT General developers list." <cdt-dev@xxxxxxxxxxx>

Cc:

Chris Recoskie/Toronto/IBM@IBMCA

Date:

03/08/2011 01:56 PM

Subject:

Re: [cdt-dev] Getting ITranslationUnit from IASTTranslationUnit

Sent by:

sprigogin@xxxxxxxxxx




I'm not proposing making ITranslationUnit a requirement for creation of IASTTranslationUnit. In cases when IASTTranslationUnit is created by calling ITranslationUnit.getAST method, the IASTTranslationUnit will remember the originating ITranslationUnit. In other cases the IASTTranslationUnit.getAdaptor(ITranslationUnit.class) will return null.

Mapping from IASTTranslationUnit to ITranslationUnit through IASTFileLocation requires additional knowledge of whether the IASTTranslationUnit originated from a working copy or not. This makes it hard and error prone.

-sergey

On Tue, Mar 8, 2011 at 2:34 AM, Chris Recoskie <recoskie@xxxxxxxxxx> wrote:
    The standalone indexer doesn't get any ITranslationUnits, it only receives a list of file paths that it needs to parse. For the standalone indexer, OSGI is not even running.

    There are also other clients of the standalone parser that aren't using RDT, so what Mike said about having the remote version of the CModel stuff doesn't apply to everyone.

    Can you clarify why this is needed? I would think that you could use the IAstFileLocation to get the path to the file, and then use that to look up a resource in the workspace. From there you can interrogate the CoreModel to get at the ITranslationUnit.



    ===========================
    Chris Recoskie
    Team Lead, IBM CDT and RDT
    IBM Toronto

    Inactive hide details for Sergey Prigogin ---03/04/2011 08:12:29 PM---Does anybody know why IASTTranslationUnit doesn't provideSergey Prigogin ---03/04/2011 08:12:29 PM---Does anybody know why IASTTranslationUnit doesn't provide a method returning the ITranslationUnit fr


    From:

    Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx>

    To:

    "CDT General developers list." <cdt-dev@xxxxxxxxxxx>

    Date:

    03/04/2011 08:12 PM

    Subject:

    [cdt-dev] Getting ITranslationUnit from IASTTranslationUnit

    Sent by:

    cdt-dev-bounces@xxxxxxxxxxx




    Does anybody know why IASTTranslationUnit doesn't provide a method returning the ITranslationUnit from which the AST was built? Such method would be handy in many places, for example in CodanCReconciler.reconciled method.


    -sergey_______________________________________________

    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





GIF image

GIF image


Back to the top