I don’t think that was the design intent. The idea is that a given file in the active configuration has a language and a lot of work is done in MBS to figure
out which inputType to use to figure that out. Stick a breakpoint in InputType.getLanguageId() to see it in action.
Digging into things a little (lot) deeper, I can see where CLanguageSettingCache actually has the languageId with it. The DescriptionScannerInfoProvider has
access to it when creating the ExtendedScannerInfo which gets passed up to the parser in TranslationUnit.getAST() but it doesn’t pass it along. Funny enough a couple of lines later it tries to figure out the ILanguage, so close, so far.
Maybe the right answer is to add the language to the ExtendedScannerInfo so that TranslationUnit can get at it. Anyone have an opinion on that?
Doug.
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Andrew Gvozdev
Sent: Monday, July 18, 2011 10:38 PM
To: CDT General developers list.
Subject: Re: [cdt-dev] Language extension driven by compiler inputType
You can inquire IConfiguration->ITool->IInputType inside MBS but I don't think you can get language to core that way. That would be ambiguous anyway as there could be several tools in toolchain and you can't access the tools from core.
You probably need to introduce a new content type and find the language from file extension via content type. I looked briefly and it seems that CConfigurationDescription.getLanguageSettingForFile() works that way.
Andrew
On Mon, Jul 18, 2011 at 10:02 PM, Schaefer, Doug <Doug.Schaefer@xxxxxxxxxxxxx> wrote:
Hey gang,
I’m not sure how many people have done this, but I’m hoping someone out there can help. I’m writing a build integration for a new compiler (new to CDT at least). It supports a few
language extensions. Now I thought I’d try by setting the languageId attribute in the inputType element of my compiler and figured that information should somehow get to the scanner. But no luck.
As far as I can tell, the gcc languages work because their the default, not because of the languageId setting in the build definitions. Has someone got this to work and can point
me where I’m missing something.
Thanks,
Doug.
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev