From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 807CF3858402 for ; Thu, 24 Aug 2023 14:39:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 807CF3858402 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692887948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7edK7MlF4oycdMXkbYFPByfq2+FNJgBE9s336N7/nJs=; b=B0lfGDnKeg5wu5aIZ7TnOiXk8agqN3i9PWo8WPdH0RB6sqT4/O0mNjD3+3axnZXNXp/EAp l9YeKerQYVggD11QYRL0kP9DavkEAobAkgKTkS86rbcLRxaMbSHAuCGgkq6YHGfaHQFElT Nv4mK74JJxjAL9BIJWNcqqCf1jJy3H4= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-70-jGCT9VwTNmuwjYnci6peuQ-1; Thu, 24 Aug 2023 10:39:06 -0400 X-MC-Unique: jGCT9VwTNmuwjYnci6peuQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A40F02807D62 for ; Thu, 24 Aug 2023 14:39:06 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.22.32.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id 80B5D40D2839; Thu, 24 Aug 2023 14:39:06 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 4/9] analyzer: eliminate region_model::get_string_size [PR105899] Date: Thu, 24 Aug 2023 10:38:58 -0400 Message-Id: <20230824143903.3161185-5-dmalcolm@redhat.com> In-Reply-To: <20230824143903.3161185-1-dmalcolm@redhat.com> References: <20230824143903.3161185-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: gcc/analyzer/ChangeLog: PR analyzer/105899 * region-model.cc (region_model::get_string_size): Delete both. * region-model.h (region_model::get_string_size): Delete both decls. --- gcc/analyzer/region-model.cc | 29 ----------------------------- gcc/analyzer/region-model.h | 3 --- 2 files changed, 32 deletions(-) diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index cc8d895d9665..1fe66f4719fa 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -2794,35 +2794,6 @@ region_model::get_capacity (const region *reg) const return m_mgr->get_or_create_unknown_svalue (sizetype); } -/* Return the string size, including the 0-terminator, if SVAL is a - constant_svalue holding a string. Otherwise, return an unknown_svalue. */ - -const svalue * -region_model::get_string_size (const svalue *sval) const -{ - tree cst = sval->maybe_get_constant (); - if (!cst || TREE_CODE (cst) != STRING_CST) - return m_mgr->get_or_create_unknown_svalue (size_type_node); - - tree out = build_int_cst (size_type_node, TREE_STRING_LENGTH (cst)); - return m_mgr->get_or_create_constant_svalue (out); -} - -/* Return the string size, including the 0-terminator, if REG is a - string_region. Otherwise, return an unknown_svalue. */ - -const svalue * -region_model::get_string_size (const region *reg) const -{ - const string_region *str_reg = dyn_cast (reg); - if (!str_reg) - return m_mgr->get_or_create_unknown_svalue (size_type_node); - - tree cst = str_reg->get_string_cst (); - tree out = build_int_cst (size_type_node, TREE_STRING_LENGTH (cst)); - return m_mgr->get_or_create_constant_svalue (out); -} - /* If CTXT is non-NULL, use it to warn about any problems accessing REG, using DIR to determine if this access is a read or write. Return TRUE if an OOB access was detected. diff --git a/gcc/analyzer/region-model.h b/gcc/analyzer/region-model.h index 9c6e60bbe824..41df1885ad5b 100644 --- a/gcc/analyzer/region-model.h +++ b/gcc/analyzer/region-model.h @@ -469,9 +469,6 @@ class region_model const svalue *get_capacity (const region *reg) const; - const svalue *get_string_size (const svalue *sval) const; - const svalue *get_string_size (const region *reg) const; - bool replay_call_summary (call_summary_replay &r, const region_model &summary); -- 2.26.3