[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Your advice
|
- From: Nathan Ridge <zeratul976@xxxxxxxxxxx>
- Date: Thu, 27 Feb 2020 02:50:16 +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=q34UGuJZmgE/CMvQz5cwIrEegRXgd25bgXatAuMgaSA=; b=IB/ETpinOV7SWLjM937Vsla1WOMiJONAw+76AwrhcTkDS4CksCdtTLBjhPISoZgHJFlR9CwwuoAMoahf680FSc0t04Ae5ZLzXKXx+Qe4lbcMYm6Xu1fZjl/M/Kx3rvaB1BXyvaF+FruLgoX6WIgp4TnBe5Dw0OieryY/7hrO4hwQ774LVW17fJyysg0FyXdJLSz7+NdvP/4TrL1LmKlPhBOgfGOuIw/lymfOkANZleuBGzLyxvocT7h8UAQEqeyx9UNMjvxhyrYqEdOkVYqYaV51jMvaaBvzzraRc83ID6sck55D3i4pTfr+JuRpKc8XmChiLesySPx5JJAw8t6YCg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bCtj/6emucfq2DN8pL6lrt/VDcKVGCD9/KUEYUEDXc4lCO83otzpSgjXYNF3Tft0toTqyAV+PWKWTxNe8i/32uI0Qjoo4N+MYIRdwobhSE9Q1rD7a4pdpWnrJbuLvy6ALaP+Mrs5Q9EXIuO5ROQ7A++cj0002I5A103v1LJ0sLooAX0GRL4RPSB85Nyg6cfNJ1izS3noxL9j+j961UKdSduzSYccx96qwNHxJcsKZac1XCkRkax6fQeqSx6ggWzV+RKYkpRrg8507YyLQ7n/66P+9ywuLHgM8Du163F1VuVeyaxoHX6Ryx55c2aaHI01F2AkKRKjdleKnnEfNUm8sg==
- 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: AQHV65S4k1GaPOv83Eick3ZQtzFoQqgrV4uAgAFgY8uAAA6VgIAAQeShgAFOp1M=
- Thread-topic: [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