Message ID | 20230721230851.1981434-3-lhyatt@gmail.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp514170vqg; Fri, 21 Jul 2023 16:11:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlEjFlZAxbkOYAaGnVkPGXM1PkbYe/zGaILBciRguueiL4K+IlP+56WYh4Y9H8CXzm558t8o X-Received: by 2002:a17:906:15d:b0:991:b834:af83 with SMTP id 29-20020a170906015d00b00991b834af83mr1920034ejh.59.1689981084328; Fri, 21 Jul 2023 16:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689981084; cv=none; d=google.com; s=arc-20160816; b=E2OFNTkZHEM5uVQztxV/l0/GUs7S/PTF1EOdGYgnt7C+B3PhrzpgsakFcuXFcKIm3N dkBGjXb/vDmMjdS6dMp8jrmqlZjYo6tZ83SxSa/80m8lYlU/7LFr4qk2INVViLd6VpEL x9ZvhjPnve7Q6aovPudQmm6oFiHwaosGUqY4WlblD1YFHt3a7h5IxoH7nw1YdG0yyPAX JueKSKB1jO44Lu0qBuYmzLYd0MW7f1zcBXanY8k008WwPgTD/onos6a7wpl/BOy7ULjY Nn2E9IQKWZNoiSSVjdBzZSdc3VSf7HSDDqwsLkARZH38SQ7iAJjpg49Gl3YtNdwQehmj UYvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=dX2+xzTpqWtDJe91dl4pvitSpi3wqch6kv1wkVj4YOU=; fh=hLxXrzU+VDBolomQxjoi9c6yn4Oij2Jaf7BaYMHGh24=; b=z355rbUHMMXao+CRAigI5ENzfkyoeOyvKr7t9NRDHSexAGXwesnJ35XeGGPsgXGgA/ iAVZMv0EsLxqMXZSh4hmAd5ueQ3FfwAzgZqCkdlwswwH90MsedAC6koShloaEHPTfS2F QJJ/6x3S7i1D5EpkJMyKynrLRUZ8dyEs8CsrsoRLXtAGM8B174XTc/9vqRQYOfx5/QTX nrevjIGkik9Rmd75kI+HjNPFDHWStb8iXdZt9LByviUALGG6Ig4HuJckMoxTwa0yHWwa mIJCc+JwvmazEUk67RTLtQ09SxOesyYROvMlG/K+psnVaoQY7aW+WvnEJeWSn+kTz+zN mEVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=wugatELc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id y20-20020a1709064b1400b0098865b84499si2688936eju.433.2023.07.21.16.11.24 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 16:11:24 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=wugatELc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D6E6338515F9 for <ouuuleilei@gmail.com>; Fri, 21 Jul 2023 23:09:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6E6338515F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689980988; bh=dX2+xzTpqWtDJe91dl4pvitSpi3wqch6kv1wkVj4YOU=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=wugatELc4GbSHM8H7l+hC+w8OKnhWTl78VHoiFSUUrByQxyVyoIzpfb3i6wegZkvV eZxs0hcBPgqdBSjiImYM5+1yEfc97D8X5Znwf+wM/2ak8eIm9prawuurhlihjTjdzo yUOh+KF0dA8MX20E7llQ2uFs6lJaL6CeHXzSfW/w= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by sourceware.org (Postfix) with ESMTPS id 209C9385DC0C for <gcc-patches@gcc.gnu.org>; Fri, 21 Jul 2023 23:09:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 209C9385DC0C Received: by mail-qt1-x82a.google.com with SMTP id d75a77b69052e-4046cdbff16so20653511cf.1 for <gcc-patches@gcc.gnu.org>; Fri, 21 Jul 2023 16:09:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689980940; x=1690585740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dX2+xzTpqWtDJe91dl4pvitSpi3wqch6kv1wkVj4YOU=; b=KLBSVWRrXUcnatqIz8m5zn7Ln2fN8bkgTU6y9TYudxFvkyFSsuHGblFAg2pIHYFvFs qrONzlu4P5lHYcpcmJOG2csbYOOZkkn49CohrGnd2UW/l4oiKMIX6XbmchUxbFBPISGC UcmI5d/BOqpRRllLCIJUfiXb2tVP8Y+mvahVTFsG1asKCWR6fByvTM0aDqznZ4dnV0wh DtPcKIn6+JCR4YzpuYFr5FMZygso55DPod1I9R1oqAbctFkr46cVK2zTNMJhYdVHksRS 8KQvtraOYaQy9VSSD0/Tk/ziQ+eeCCnwkMnupAMPtJ0C4F/eqrqsGY6XmbKvv/5LGEjr 5lpQ== X-Gm-Message-State: ABy/qLa099Y9obkRpTwzvYPi9+8ZhRZEqUkM6W6IrIWaBbQDE/j0oGlz Cl0HuwbqmIHPqjEzPZNEKAwghitQG1c= X-Received: by 2002:a05:622a:11c2:b0:400:797e:d690 with SMTP id n2-20020a05622a11c200b00400797ed690mr2189075qtk.1.1689980939910; Fri, 21 Jul 2023 16:08:59 -0700 (PDT) Received: from localhost.localdomain (96-67-140-173-static.hfc.comcastbusiness.net. [96.67.140.173]) by smtp.gmail.com with ESMTPSA id r26-20020ac8521a000000b00402ed9adfa1sm1586754qtn.87.2023.07.21.16.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 16:08:59 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: David Malcolm <dmalcolm@redhat.com>, Lewis Hyatt <lhyatt@gmail.com> Subject: [PATCH v3 2/4] diagnostics: Handle generated data locations in edit_context Date: Fri, 21 Jul 2023 19:08:49 -0400 Message-Id: <20230721230851.1981434-3-lhyatt@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230721230851.1981434-1-lhyatt@gmail.com> References: <20230721230851.1981434-1-lhyatt@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3038.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Lewis Hyatt via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Lewis Hyatt <lhyatt@gmail.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772073605614345204 X-GMAIL-MSGID: 1772073605614345204 |
Series |
diagnostics: libcpp: Overhaul locations for _Pragma tokens
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Lewis Hyatt
July 21, 2023, 11:08 p.m. UTC
Class edit_context handles outputting fixit hints in diff form that could be manually or automatically applied by the user. This will not make sense for generated data locations, such as the contents of a _Pragma string, because the text to be modified does not appear in the user's input files. We do not currently ever generate fixit hints in such a context, but for future-proofing purposes, ignore such locations in edit context now. gcc/ChangeLog: * edit-context.cc (edit_context::apply_fixit): Ignore locations in generated data. --- gcc/edit-context.cc | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/gcc/edit-context.cc b/gcc/edit-context.cc index 6f5bc6b9d8f..ae11b6f2e00 100644 --- a/gcc/edit-context.cc +++ b/gcc/edit-context.cc @@ -301,8 +301,12 @@ edit_context::apply_fixit (const fixit_hint *hint) return false; if (start.column == 0) return false; + if (start.generated_data) + return false; if (next_loc.column == 0) return false; + if (next_loc.generated_data) + return false; edited_file &file = get_or_insert_file (start.file); if (!m_valid)