Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] INodeFactory and ICPPNodeFactory
  • From: Nathan Ridge <zeratul976@xxxxxxxxxxx>
  • Date: Thu, 27 Feb 2020 02:37:45 +0000
  • Accept-language: en-CA, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RLwldZYc7B8uifLrkwblxHY1X/f9YXrgvWIvgNNSX5A=; b=OvG+BNRBFiwUTCjireuVS7yQShzve8JYCIIqpHXy98b+27qVN7H2ENd05Wvf+d0a1BpTpkd1GlWafBpS7hYYTFdv63OAxGK1yd6s2IZwobs5rbguBRr5/zGoRX7cPsHiiLWCuI9tNc0317Y9fU7dpFmc/DI2DWK8MpoWMdUooUj8Oeuj6B3c1+y3r6RnVsyyx7/YkeWKU36nl4QjeQuk14LJkZvSGhX4xzBOAiye65n4LQ6JPClEqqP2dJVTEse1YlCSs08Rg5woLkUuxPmLOewQFRLwqqpbuoS+hm/2hodImCooPcm/B+FZKW0W7+/sQDTXekLGVlVi2PKpXwy8CA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DPEXGIqvhfUssyLa8nm3xYIaAm6Y4MYTmKEWFlG8FA7IHfPt8hqYNggv21wkHMCmbA6OmFdzcA96OLaj/VpRUPgTD3Edq/qU+Ikq6UwqKbWmaFFc3rSwOztq+t2NBhrQfXN5oqgUrQY8bqaHeZmMcqQCQMRcw6dZfcEeS4eHCGrcnwOF79nj70lJK40IL7eC8TPrRhipiqs6Ti1abggNrLP3CltF/Y8+6dfE6q6mhFU5LoXSHatc6ww6ehLvbampDbgIuDGQaPBlqGJkgaqn//jGNHdsUpktn47cp7Hne+1PPEmVTFveMwzh9/6dbv04QBJGgW8dZIf4yzoSguXKbA==
  • Delivered-to: cdt-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/cdt-dev>
  • List-help: <mailto:cdt-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/cdt-dev>, <mailto:cdt-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/cdt-dev>, <mailto:cdt-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AQHV7IBhDeL+/QVjdk+8ga2MEGuBRaguTpSagAAFeYg=
  • Thread-topic: INodeFactory and ICPPNodeFactory

A C++ translation unit will have a C++ node factory. So, code like the following is reasonable:

if (ast instanceof ICPPASTTranslationUnit) {
  ICPPNodeFactory cppNodeFactory = (ICPPNodeFactory) ast.getASTNodeFactory();
  // use cppNodeFactory
} else {
  // not a C++ translation unit
}

Hope that helps,
Nate

________________________________________
From: cdt-dev-bounces@xxxxxxxxxxx <cdt-dev-bounces@xxxxxxxxxxx> on behalf of Ming Cheng <chengm349@xxxxxxxxxxx>
Sent: February 27, 2020 2:16 AM
To: CDT General developers list.
Subject: Re: [cdt-dev] INodeFactory and ICPPNodeFactory

I know everyone is very busy.
Hope any expert can give some guide.

Thank you very much!

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

From: Ming Cheng<mailto:chengm349@xxxxxxxxxxx>
Sent: Wednesday, February 26, 2020 4:52 PM
To: cdt-dev@xxxxxxxxxxx<mailto:cdt-dev@xxxxxxxxxxx>
Subject: [cdt-dev] INodeFactory and ICPPNodeFactory

Hi,


IASTTranslationUnit ast = CurrentGui.getInstance().getGui().getAST(file);
ASTRewrite r = ASTRewrite.create( ast );
addIncludeDirectives(ast, r, className + ".h");

 INodeFactory factory = ast.getASTNodeFactory();

I have ast, is there a way to get ICPPNodeFactory? I want to "new" a class declaration as simple and natural as possible. For example I don't want ASTRewrite's createLiteralNode to get a IASTNode.  Then to add some class's elements. I prefer to get a IASTSimpleDeclaration with ICPPASTCompositeTypeSpecifier.k_class .

Rgds.
Ming Cheng



Back to the top