From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8378FC433FE for ; Sat, 15 Oct 2022 13:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbiJONfr (ORCPT ); Sat, 15 Oct 2022 09:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbiJONfp (ORCPT ); Sat, 15 Oct 2022 09:35:45 -0400 X-Greylist: delayed 1272 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 15 Oct 2022 06:35:43 PDT Received: from kylie.crudebyte.com (kylie.crudebyte.com [5.189.157.229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EA9F4D162 for ; Sat, 15 Oct 2022 06:35:43 -0700 (PDT) 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" Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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