Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E3A6C433FE for ; Sat, 15 Oct 2022 13:29:45 +0000 (UTC) Received: from localhost ([::1]:46898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ojhEW-000600-Dl for qemu-devel@archiver.kernel.org; Sat, 15 Oct 2022 09:29:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ojh03-0000HP-4T; Sat, 15 Oct 2022 09:14:47 -0400 Received: from kylie.crudebyte.com ([5.189.157.229]:54837) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ojgzy-0001ty-Hk; Sat, 15 Oct 2022 09:14:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=kylie; h=Content-Type:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Content-ID:Content-Description; bh=1xgL3nGmvsWM+eEOqBnpQ1xASQnjO01Ot02KqniN8vM=; b=Zx4UzJcow0ashPdOdi8f+pS9eG qsgoKZAQcc+D7sdLgmFBo5xEARyUMJsBv6HiMEMlQ76VeBQ179vdsk4JacN11Y/Rbep45xjXd5qnI KX37Mc2m22PUWKvGm3bKcMJvT5rHPo9ZYBw72EZOBBz0zkK8wiA67M4h0XZrCOycMz9FX3jQvJ6ZE ch4fZ2Ym+8zSLRa3mzdefRGxh+uDczZHVdoWZX0M5tz3EO3/e0FA41U78TrQilfMU69UpV8UameAy oc8ptxr0f1gPOkM1fyVnNxkUxAOZl7yQWoWoRRvfuSN/rkfMu72QY1ivIJazAz5Rxt+/LKGW4J3RE dcSbXGMMTxSNXLUIhcE5az+bBPmpH8sXIy9Lk8uRFe9LTVHAOc0IHjxv6XAJ4UNd4gzvyoH8+yZQQ DCOX8xz/YbD5INB8IIV4KAffRsif2m4Kw7IjTNT9FkWF+Ca2Nvj6/q2zCjlBLA4EHOG2Dn05RBYfc pePgwhzPZmJqmEG9JHwzPPsxoCSR2Loz1a6yT185sbdqH5FvCNfnkYLd7bJsnsgV/R5OPo4T9wysO 6+MIxcV+y+CYdtxZAboVQhg6P2XyhIT57sV3PZ0Tn6+8b/38GKc4LRFV1DH0vNZOLM3oztpwRR9vJ b8DlROi0AYXbgpm8IAwLTsyhaDNoGdMd6codbqs/A=; From: Christian Schoenebeck To: qemu-devel@nongnu.org, Paolo Bonzini Cc: Alberto Faria , =?ISO-8859-1?Q?Marc=2DAndr=E9?= Lureau , Stefano Garzarella , Hannes Reinecke , "Dr. David Alan Gilbert" , Vladimir Sementsov-Ogievskiy , "Maciej S. Szmigiero" , Peter Lieven , kvm@vger.kernel.org, Xie Yongji , Eric Auger , Hanna Reitz , Jeff Cody , Eric Blake , "Denis V. Lunev" , Daniel =?ISO-8859-1?Q?P=2E_Berrang=E9?= , Philippe =?ISO-8859-1?Q?Mathieu=2DDaud=E9?= , Stefan Weil , Klaus Jensen , Laurent Vivier , Alberto Garcia , Michael Roth , Juan Quintela , David Hildenbrand , qemu-block@nongnu.org, Konstantin Kostiuk , Kevin Wolf , Gerd Hoffmann , Stefan Hajnoczi , Marcelo Tosatti , Greg Kurz , "Michael S. Tsirkin" , Amit Shah , Alex Williamson , Peter Xu , Raphael Norwitz , Ronnie Sahlberg , Jason Wang , Emanuele Giuseppe Esposito , Richard Henderson , Marcel Apfelbaum , Dmitry Fleytman , Eduardo Habkost , Fam Zheng , Thomas Huth , Keith Busch , Alex =?ISO-8859-1?Q?Benn=E9e?= , "Richard W.M. Jones" , John Snow , Markus Armbruster Subject: Re: [RFC v2 00/10] Introduce an extensible static analyzer Date: Sat, 15 Oct 2022 15:14:20 +0200 Message-ID: <3662732.oTPJGMJ31K@silver> In-Reply-To: References: <20220729130040.1428779-1-afaria@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: pass client-ip=5.189.157.229; envelope-from=qemu_oss@crudebyte.com; helo=kylie.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Freitag, 14. Oktober 2022 00:00:58 CEST Paolo Bonzini wrote: [...] > However, it seems like a lost battle. :( Some of the optimizations are > stuff that you should just not have to do, for example only invoking > "x.kind" once (because it's a property not a field). Another issue is > that the bindings are incomplete, for example if you have a ForStmt > you just get a Cursor and you are not able to access individual > expressions. As a result, this for example is wrong in the > return-value-never-used test: > > static int f(void) { return 42; } > static void g(void) { > for (f(); ; ) { } /* should warn, it doesn't */ > } > > and I couldn't fix it without breaking "for (; f(); )" because AFAICT > the two are indistinguishable. You mean accessing the `for` loop's init expression, condition expression, increment statement? AFAICS those are accessible already by calling get_children() on the `for` statement cursor: https://github.com/llvm/llvm-project/blob/main/clang/bindings/python/clang/cindex.py#L1833 I just made a quick test with a short .c file and their demo script: https://github.com/llvm/llvm-project/blob/main/clang/bindings/python/examples/cindex/cindex-dump.py And I got all those components of the `for` loop as children of the `for` cursor. Best regards, Christian Schoenebeck