get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/2233049/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2233049,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2233049/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260505151030.1749548-13-waffl3x@baylibre.com/",
    "project": {
        "id": 17,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/17/?format=api",
        "name": "GNU Compiler Collection",
        "link_name": "gcc",
        "list_id": "gcc-patches.gcc.gnu.org",
        "list_email": "gcc-patches@gcc.gnu.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260505151030.1749548-13-waffl3x@baylibre.com>",
    "list_archive_url": null,
    "date": "2026-05-05T15:02:05",
    "name": "[12/12] OpenMP/C++: Avoid quadratic complexity in diagnostic",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "8decbaf5f9fc5908442d4978438eb7ea4caf9186",
    "submitter": {
        "id": 90070,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/90070/?format=api",
        "name": "Waffl3x",
        "email": "waffl3x@baylibre.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260505151030.1749548-13-waffl3x@baylibre.com/mbox/",
    "series": [
        {
            "id": 502853,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/502853/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=502853",
            "date": "2026-05-05T15:01:54",
            "name": "OpenMP/C++: 'allocate' directive",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/502853/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2233049/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2233049/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=baylibre-com.20251104.gappssmtp.com\n header.i=@baylibre-com.20251104.gappssmtp.com header.a=rsa-sha256\n header.s=20251104 header.b=f5M2Fzym;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)",
            "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=baylibre-com.20251104.gappssmtp.com\n header.i=@baylibre-com.20251104.gappssmtp.com header.a=rsa-sha256\n header.s=20251104 header.b=f5M2Fzym",
            "sourceware.org;\n dmarc=none (p=none dis=none) header.from=baylibre.com",
            "sourceware.org; spf=pass smtp.mailfrom=baylibre.com",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=2607:f8b0:4864:20::432"
        ],
        "Received": [
            "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g92Dc4RCnz1yJx\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 06 May 2026 01:17:04 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 9EFC94BA79BD\n\tfor <incoming@patchwork.ozlabs.org>; Tue,  5 May 2026 15:17:02 +0000 (GMT)",
            "from mail-pf1-x432.google.com (mail-pf1-x432.google.com\n [IPv6:2607:f8b0:4864:20::432])\n by sourceware.org (Postfix) with ESMTPS id 10FD84BA9034\n for <gcc-patches@gcc.gnu.org>; Tue,  5 May 2026 15:10:49 +0000 (GMT)",
            "by mail-pf1-x432.google.com with SMTP id\n d2e1a72fcca58-826dab01bbdso200994b3a.0\n for <gcc-patches@gcc.gnu.org>; Tue, 05 May 2026 08:10:48 -0700 (PDT)",
            "from waffl3x-prestige.lan ([2001:56a:f98a:b800:1f67:ce08:3cbd:86b8])\n by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-83965645140sm2674956b3a.12.2026.05.05.08.10.47\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 05 May 2026 08:10:47 -0700 (PDT)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 9EFC94BA79BD",
            "OpenDKIM Filter v2.11.0 sourceware.org 10FD84BA9034"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 10FD84BA9034",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 10FD84BA9034",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777993849; cv=none;\n b=Az1WOwvIUHOkQ+GHZoZ81Oo7nIwcV/gA7PuIV79HepX99JxRd1UWpQ7NyI+rmYjbtjsKB/rJ8QNZVw2zDR26bEB+GaWeUq1MeBbRFR5/n8RWN7L4pqYBO59Ij7Z3q8DYseMVeS6+fqK5wYuGXXOH+IjRUoIVVuE/19BmNQ5o75E=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777993849; c=relaxed/simple;\n bh=cayDpVIMfIzVOLaAPcYBk3NwL7vxsX3nXeq6HfDg7vk=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=pRgh/zNdsNEnB5TwPYLMm91KMNdoWYz7av6RuaqtTF/7C7zIIRO2QszOms4za1trOKZEAiJGNfMwklNZyTKw9ynJ0hE6mIebYr/5a8GN2hjpIPEfOP84uyMr2Rrz0pMwTz7D84L9rO0kk6eoSkugsDXO2uiRUCNkKwgyYihl+ik=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=baylibre-com.20251104.gappssmtp.com; s=20251104; t=1777993848;\n x=1778598648;\n darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=17twbgtCGIUEk1yX1pJPUHPRSkOOgtZcPpiMPKK7G24=;\n b=f5M2FzymZ3kFUH5TnpwOcjJE+hJXLd4+cIsghDT77t/KlFcMcTFpvmkc0vlqhAlg/y\n Sx59mb7vE7MDkI8GaDL9Tu0VJZA9UvxVtoAU5ZC/Ighz6g9oOso3a/S7gOVvtV2Yudad\n VD/vEO46yGNuYzqa8DOBOkdAc6qL4Le/h7K0o/0RPUBpGL9BIRxZekJtuRpExwKYlz6r\n XAVJ10IMQuFFUKmPcKe0NaGGC6/H6BMYiyPFDCe3CNHZL6BNa4qleK/rPNIoI54Sc7nZ\n /FwDBaXcWCYwrIS73czz9GnO4QvYwiY1LCqaT6SLiz/yoD/PHahVWJ75KsuC73C1OXuy\n 0I2A==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777993848; x=1778598648;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=17twbgtCGIUEk1yX1pJPUHPRSkOOgtZcPpiMPKK7G24=;\n b=T+snWWgymVNjkyIqKjQBBA089+flDbN5Zcul8skjQ+NSibrr0Yu7DjK0QZlxzS1AHU\n mK/9VDty4ijUrw1fPFj5nk47Xm1FnCDjdBI9Cb3S6yl7l2keVY3Vhj2WRkg1AZq9Yzmo\n 4N5ey0Zpyxe8RJv5bikKue/mFF+ApSV3ZjQn/K1M+gcvewXbWvOUfdQZkUpU9iF5ZhEA\n nlasxUiEPKunfJrgJ0fL4gVsXbh+lRWhcTzcxTc0IyQWYjCeY7zuqGuZouZHfcfLeHwC\n WM09ZGbSZkw6kgu5Djyc+5AmREvoLn2+fLPSsWuFZ0+KMa34nEy1R3lrQX2sHoFU/QZl\n pZIQ==",
        "X-Gm-Message-State": "AOJu0YwA0N+s7MKrnFdW2MYIfq2YoiWcWMCqC3Sy7ZhXsyttNYl5Xzka\n eErfaCFiQFVi+aBjvRguUwlb7nLhuJ2FKCgYAOI6ZLe2qUWkd3sFdwUnKCBmoEaB7JCtw8TxW/O\n Zva69",
        "X-Gm-Gg": "AeBDievIirSQ6POaT+mVh/kyj7PWs59E66HeF6J+ge6xvWbL0asrP+Yj5ZfVSJEa5xg\n d7Y+sEh3Ib6ppbY6l0T8et81hpi1gHbrdPn4Nba33hJ7GhvnGBlX7e1HBeGe8Kld6h/YKlPYfuK\n 9E9B9t0ZObyjrRATixSDW57g7gAtTgNQ2pki2wjrshkwDVCErlsnuU1ShJ0GxRfwg6mDvccQ74O\n lod32JiUWbVANgNmO2G71e02jv4t7JgggVwB1pwjLjJtexi8lFHTcOKS72GTbkh2iWnVDCNa2dW\n 1anR15eLTzmus2bLaRYQEWqF4n9nZiKS6q1QThTqX0hj6bjp3G4vV6WgXTs1uTphHaD/Cqun1AQ\n L/jUvV4804wf+kye5go4xUCl5savNBgIb2rasV/V7CLM3W0e00TjsOWMVgxhxOFRN03H0G5AFUG\n dOY1XVmDVJTXGU8xoQsGichMLQtMv/Ob0OX14qrgRZkcYM4e30dw==",
        "X-Received": "by 2002:a05:6a00:1f17:b0:82d:1faf:775f with SMTP id\n d2e1a72fcca58-8393e36240bmr1520875b3a.5.1777993847936;\n Tue, 05 May 2026 08:10:47 -0700 (PDT)",
        "From": "Waffl3x <waffl3x@baylibre.com>",
        "To": "gcc-patches@gcc.gnu.org",
        "Cc": "Waffl3x <waffl3x@baylibre.com>",
        "Subject": "[PATCH 12/12] OpenMP/C++: Avoid quadratic complexity in diagnostic",
        "Date": "Tue,  5 May 2026 09:02:05 -0600",
        "Message-ID": "<20260505151030.1749548-13-waffl3x@baylibre.com>",
        "X-Mailer": "git-send-email 2.54.0",
        "In-Reply-To": "<20260505151030.1749548-1-waffl3x@baylibre.com>",
        "References": "\n <CAH+W3Ppbho4pj6W-rWk4mMssrttOjt7aNco-oWW5Sw5f5Yx2GA@mail.gmail.com>\n <20260505151030.1749548-1-waffl3x@baylibre.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "gcc-patches@gcc.gnu.org",
        "X-Mailman-Version": "2.1.30",
        "Precedence": "list",
        "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>",
        "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <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>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>",
        "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"
    },
    "content": "The previous implementation of var_is_in_scope unfortunately did not avoid\nquadratic complexity. This implementation utilizes procedural caching to\navoid that while also avoiding traversing the entire list of block vars in\nthe current binding level.\n\ngcc/cp/ChangeLog:\n\n\t* parser.cc (cp_parser_omp_allocate): Change var_is_in_scope.\n\nSigned-off-by: Waffl3x <waffl3x@baylibre.com>\n---\n gcc/cp/parser.cc | 54 +++++++++++++++++++++++++++++++-----------------\n 1 file changed, 35 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc\nindex fe628be065c..4f30b83666c 100644\n--- a/gcc/cp/parser.cc\n+++ b/gcc/cp/parser.cc\n@@ -47195,25 +47195,41 @@ cp_parser_omp_allocate (cp_parser *parser, cp_token *pragma_tok)\n      what ultimately gets passed along to finish_omp_allocate.  */\n   hash_map<tree, location_t> arg_map;\n   {\n-    auto var_is_in_scope = [&] (tree var_decl)\n-      {\n-\t/* (OpenMP 6.0 311:11-12) An allocate directive must appear in the same\n-\t   scope as the declarations of each of its list items and must follow\n-\t   all such declarations.\n-\n-\t   Note that it states declarations, not definitions, thus we can rely\n-\t   on VAR_DECL's CP_DECL_CONTEXT.  This will correctly reject an\n-\t   allocate directive applied to a definition in a different scope.  */\n-\tif (!DECL_DECLARES_FUNCTION_P (directive_ctx))\n-\t  return CP_DECL_CONTEXT (var_decl) == directive_ctx;\n-\t/* This is O(n^2), caching names during traversal might be better.  */\n-\tfor (tree block_var = current_binding_level->names;\n-\t     block_var != NULL_TREE;\n-\t     block_var = DECL_CHAIN (block_var))\n-\t  if (block_var == var_decl)\n-\t    return true;\n-\treturn false;\n-      };\n+    /* To avoid quadratic complexity in the block scope case we need to keep\n+       some state.  Our hash_set utility has a lazy option, but it sucks so\n+       we'll just bite the allocation unconditionally.  */\n+    auto var_is_in_scope\n+      = [&, vars_in_scope = hash_set<tree>(),\n+\t block_var = current_binding_level->names] (tree var_decl) mutable\n+\t  {\n+\t    /* (OpenMP 6.0 311:11-12) An allocate directive must appear in the\n+\t       same scope as the declarations of each of its list items and\n+\t       must follow all such declarations.\n+\n+\t       Note that it states declarations, not definitions, well-formed\n+\t       uses of this directive will always be in the same scope as the\n+\t       DECL_CONTEXT of VAR_DECL.  */\n+\t    if (!DECL_DECLARES_FUNCTION_P (directive_ctx))\n+\t      return CP_DECL_CONTEXT (var_decl) == directive_ctx;\n+\t    /* We can't rely on this for block scope though and must traverse\n+\t       the decls in this scope instead.\n+\t       As noted above, to avoid quadratic complexity we keep state\n+\t       across multiple calls, caching as we go to avoid going through\n+\t       all names in this scope up front.  */\n+\t    if (vars_in_scope.contains (var_decl))\n+\t      return true;\n+\t    /* We initialize block_var in the captures.  */\n+\t    for (; block_var != NULL_TREE; block_var = DECL_CHAIN (block_var))\n+\t      {\n+\t\t/* Matches don't have to be cached, duplicate var_decl args are\n+\t\t   diagnosed before scope is diagnosed.  */\n+\t\tif (block_var == var_decl)\n+\t\t  return true;\n+\t\telse if (VAR_P (block_var))\n+\t\t  vars_in_scope.add (block_var);\n+\t      }\n+\t    return false;\n+\t  };\n     hash_map<tree, location_t> seen_args;\n     /* The head might have an error and need to be removed.  */\n     tree *chain = &nl;\n",
    "prefixes": [
        "12/12"
    ]
}