From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3677 invoked by alias); 3 Oct 2011 22:51:06 -0000 Received: (qmail 3669 invoked by uid 22791); 3 Oct 2011 22:51:06 -0000 X-SWARE-Spam-Status: No, hits=2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-ey0-f175.google.com (HELO mail-ey0-f175.google.com) (209.85.215.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 03 Oct 2011 22:50:50 +0000 Received: by eya25 with SMTP id 25so3536587eya.20 for ; Mon, 03 Oct 2011 15:50:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.213.32.147 with SMTP id c19mr1005849ebd.10.1317682249580; Mon, 03 Oct 2011 15:50:49 -0700 (PDT) Received: by 10.213.3.16 with HTTP; Mon, 3 Oct 2011 15:50:49 -0700 (PDT) Date: Mon, 03 Oct 2011 22:51:00 -0000 Message-ID: Subject: The AST tree modification. Edited. From: niXman To: gcc@gcc.gnu.org Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg00027.txt.bz2 Hi everybody! It is necessary to implement a plug-in for GCC designed to collect the information on types of translation unit, and generate static const array of types rtti_ex _ on its base; ////////////////////////////////////// enum class type_ { char_, uchar_, short_, ushort_, int_, uint_, long_, ulong_, int64_, uint64_, array_, pointer_, double_, long_double_, float_, class_ }; struct rtti_ex_ { // <<<<<<<<<<<<<<<<<<<<<<<<< const char* name; const type_ type; const size_t size; const size_t align; const size_t offset; }; // generated from plugin. static const rtti_ex_ rtti_ex_array_[] = { {...}, {...}, {...} }; ///////////////////////////////////// There aren't any problems with information collection from AST. There is a complexity with AST modification: 1. How to declare a variable? 2. How to declare the typedef? 3. How to declare a structure? 4. How to declare an array of structures? I suppose that there should be a function like: tree make_subtree (const char* source); which result I could insert in the corresponding node. But I haven't found it. Please, give me some links on this subject. It is very desirable, if you could give some links with examples. Thanks.