From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by sourceware.org (Postfix) with ESMTPS id 4DB943858D33 for ; Thu, 5 Jan 2023 22:36:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4DB943858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-xf2f.google.com with SMTP id t7so1073333qvv.3 for ; Thu, 05 Jan 2023 14:36:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dX2+xzTpqWtDJe91dl4pvitSpi3wqch6kv1wkVj4YOU=; b=ZL6SfhEhSQgbyUA1vvxjC+31i0JZ4lDTCEt0UPlqWYYdk1+sGPxru0JU9O6DNdmkJ6 4Xpff+fimUj/Yrgxa4PH3ljEHyQoLGa9XfhBpIya3TFyUuWMt00vBTfMhI/CkeeWK/wx 5J/ZmHNi27e+0NS503MpD0/AgeHMAQ8VElQOb3MOFyJkZoExPs+kCrAwlPXMYxftCJpC J1P8fniN26LekX5KnW/k2EQUgj9FXhmsHx9d7jrakVlAb7RihMLYBRC+7mtTBGbf34j9 9HvFz6jkZcZ16HByk6d20rtjeuci75xACt6jnhZu16tOcuOyyHN5MXgIuM424PSTBR3s kZyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=LCEhV3lIoEB0lzaX7gk8tyNtiOVwKH5V0lqoXcGwW8SI9tjq2kfIu9rFyCxn8gfnya DLPwLPMorI+XtasWowzCCMkwK1gN8nvXMuNdwBtHFzoP1xUomjgfnyamcXYiYWQoxqNq 8t3vNIO8oq3UlaLlKhsn0dNMMUa4XxQ9yecluDpRJCeeuwtlgirucN1B+2VWE7OHaXC0 8+qok18iwAeIb2Bg7GHLN3hV2OGoNks9VT6TXB73vBsWephgMrJGVr4QJszEHYELqwCO 3Fw4TIBuAzwWwaVe9sfg8C583ZT3VO0b22d1v3YHfJ+PXwB4BfbuFRksGEWLN08G2NvF TRzA== X-Gm-Message-State: AFqh2kpfoazFxs7ZK+1GJ1FOjsRTSrzKjfvEESudm/oPaww1POClw94x Hy0izXa4JgTJ2i4KpQCvWLsDCCT+lWo= X-Google-Smtp-Source: AMrXdXsLScPblqRFBz4TK7e4pHaGpE0ZZgiowLeioGaqkH/DLe/8e4uV7oN924RrzmgP0IXY7IZ0mg== X-Received: by 2002:ad4:551d:0:b0:4d1:e110:1621 with SMTP id pz29-20020ad4551d000000b004d1e1101621mr70881837qvb.0.1672958194681; Thu, 05 Jan 2023 14:36:34 -0800 (PST) Received: from localhost.localdomain (96-67-140-173-static.hfc.comcastbusiness.net. [96.67.140.173]) by smtp.gmail.com with ESMTPSA id dm28-20020a05620a1d5c00b006e702033b15sm26289185qkb.66.2023.01.05.14.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 14:36:34 -0800 (PST) From: Lewis Hyatt To: gcc-patches@gcc.gnu.org Cc: David Malcolm , Lewis Hyatt Subject: [PATCH v2 2/4] diagnostics: Handle generated data locations in edit_context Date: Thu, 5 Jan 2023 17:36:06 -0500 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3038.9 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 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: 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)