Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Your advice
  • From: Ming Cheng <chengm349@xxxxxxxxxxx>
  • Date: Fri, 28 Feb 2020 03:16:40 +0000
  • Accept-language: 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=QwxsY2sZXZn4ERwNl6i2zJOU3fq75wTVGv95f/6pQ5U=; b=OAYGdTRuvf7LPyugWpTsE06c0j2xbgJjEt5PFHJNUCv+wgX1myKLECzIIcg8NPXFwElOT6VJlwM+WGkyzGiD0f+qs4ekjM2OnfuLT6rcBzqBWI/0YG9WGmsxw8ES2iTHpubOjr5OvTetjE2WbdC2Z9q+LZ5IXobvWF/yCDCMiojdGZq+u+ERJnpJhbYL3fQNCaGLVOsxHjjzEUpRkvybBWGe9Tv4g0vOLYFcmfdH+KU2DqrGscgVjP7eeDbTu9D27TrYTLTcJR74JvBU1NwVabWo7uaj08gcjm6NK0oOFBTB3lk6n1Ss6Z79yMccb8jQvYtwe8PHMwSKgjuxw7/i3Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V+U3uVuDm6qUbE6wBh/lqbpx5RMxAmQAziw19mtHjYpAUGX9fQ51KH9bvx8ysTzsKvzAKxcJ7jY8BfikEmm4sOBqy7vxBea9NXsTrxkIZ6eLq2VhXYMIuj0L4L/DwDFexMwT6WgCaetkN3CotCS6xRy+y35b1pkzKE6CYyr4ncl7v4P9XGMr2dqrQMn1WHfxO+6rS9Gztsjv2t3eGdMk1aOL5pa8ZJ9oMbKH+kYCIFz5zbHSsqV6CCJupcm0nDY+udRr25BoB9Rl68RtSgZM9esLYSjlFY/6+ecuCe3QhLBlQUp/2YAQ4LC8TVCD+6kacK7YlAZF/PXKxLRG8e8ncA==
  • 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: AQHV65S4k1GaPOv83Eick3ZQtzFoQqgrV4uAgAFgY8uAAA6VgIAAQeShgAFOp1OAAZyGAQ==
  • Thread-topic: [cdt-dev] Your advice

Hi Nate,

 

You said something but I feel they are not relevant to “yet without using internal iface/class” directly.

 

Sent from Mail for Windows 10

 

From: Nathan Ridge
Sent: Thursday, February 27, 2020 10:50 AM
To: Ming Cheng; CDT General developers list.
Subject: Re: [cdt-dev] Your advice

 

> Question is that how to know a declaration is class/struct/function as detail as possible
> yet without using internal iface/class?

This requires a bit of knowledge about the C++ grammar.

* A class/struct definition will be a simple-declaration with a composite-type-specifier as its decl-specifier, and a declarator with an empty name. (If the declarator has a non-empty name, it's actually declaring a variable of a class/struct type being defined on the fly).

* A function definition has its own grammar production (not a simple-declaration) and node type (IASTFunctionDefinition).

* A function declaration will be a simple-declaration whose declarator is a function-declarator (IASTFunctionDeclarator).

* A simple-declaration where neither of the above cases apply usually declares a variable, but it could be something else too (e.g. a typedef). You could perform additional syntactic checks to discriminate (e.g. check for presence of typedef specifier), or resolve the name in the declarator and see what type of binding (e.g. IVariable vs. ITypedef) it resolves to.

Hope that helps,
Nate

 


Back to the top