From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14246 invoked by alias); 14 Jun 2014 21:10:38 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 14100 invoked by uid 89); 14 Jun 2014 21:10:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-ve0-f169.google.com Received: from mail-ve0-f169.google.com (HELO mail-ve0-f169.google.com) (209.85.128.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 14 Jun 2014 21:10:36 +0000 Received: by mail-ve0-f169.google.com with SMTP id pa12so4810095veb.0 for ; Sat, 14 Jun 2014 14:10:33 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.58.152.234 with SMTP id vb10mr8131841veb.21.1402780232229; Sat, 14 Jun 2014 14:10:32 -0700 (PDT) Received: by 10.220.245.131 with HTTP; Sat, 14 Jun 2014 14:10:32 -0700 (PDT) Date: Sat, 14 Jun 2014 21:21:00 -0000 Message-ID: Subject: Gcc plugin for modification of source code ? From: Mohsin Khan To: gcc , "gcc-help@gcc.gnu.org" Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2014-06/txt/msg00068.txt.bz2 Hi, I'm working on a gcc plugin project. I had a doubt, can somebody help me on this. Can we write a plugin (which works after a pass like cfg or any other) which can modify the source code of .C file, for example insert comments before function definitions or insert a new IF Block in the .C file. And after modification it writes the entire modified code to a new .C file. Is this type of plugin possible in GCC. If yes, please tell me how and if No, please tell me why. Any help is much appreciated. Thanks