{"id":2196539,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2196539/?format=json","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.0/projects/17/?format=json","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},"msgid":"<20260214155201.1049644-2-dmalcolm@redhat.com>","date":"2026-02-14T15:51:57","name":"[1/5] diagnostics: use label_text for logical_location strings","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"e22f3b5ea3a972fcec7b44f74df9830c5204012c","submitter":{"id":24465,"url":"http://patchwork.ozlabs.org/api/1.0/people/24465/?format=json","name":"David Malcolm","email":"dmalcolm@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260214155201.1049644-2-dmalcolm@redhat.com/mbox/","series":[{"id":492183,"url":"http://patchwork.ozlabs.org/api/1.0/series/492183/?format=json","date":"2026-02-14T15:51:56","name":"Improve diagnostics for bad JSON inputs [PR124094]","version":1,"mbox":"http://patchwork.ozlabs.org/series/492183/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2196539/checks/","tags":{},"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 (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=BtWMHUMH;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::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 (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=BtWMHUMH","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.133.124"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::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 4fCtvZ2gNMz1xpl\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 15 Feb 2026 02:56:58 +1100 (AEDT)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 6A9A74BAD17A\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 14 Feb 2026 15:56:56 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by sourceware.org (Postfix) with ESMTP id B396D4BAD149\n for <gcc-patches@gcc.gnu.org>; Sat, 14 Feb 2026 15:52:18 +0000 (GMT)","from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-636-idgxDjr7MA2glWR5pW7LBQ-1; Sat,\n 14 Feb 2026 10:52:15 -0500","from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id BBB4A1956066; Sat, 14 Feb 2026 15:52:12 +0000 (UTC)","from t14s.localdomain.com (unknown [10.22.88.22])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 552D21955D71; Sat, 14 Feb 2026 15:52:09 +0000 (UTC)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 6A9A74BAD17A","OpenDKIM Filter v2.11.0 sourceware.org B396D4BAD149"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org B396D4BAD149","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org B396D4BAD149","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771084339; cv=none;\n b=ItY9HqhaebaquHlvFj0AgRWOLk4IjKWmhkco2/sgzPZxl+cTHmwD9KDjoFCkBNuQg/juXg8aIaIradxAaBgabMzHj6SdKfPO3P7D4pbzzyUXz6WL2X/C5VaapSl1S835QHApRryu4JA14iaKCIAryW2k5Yjkm+tMdPIT+DqlkkY=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1771084339; c=relaxed/simple;\n bh=yPGekkIp17kGeUxTIet4jLdMyE/Rtrv5rB7c57f+Jcw=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=g1CGjPjQ1y7/IgAw50KZuKE13VjhX+fS9qVAQTIBTHGuM7fD8rHw8/w3mRYcEvU6fPgsz9hJy1sblIQHCylCCrTSBFcrplosk1QdPleWj4JGSrHp/yiP9bcSBscesChSIC6pH9IOPisu4VcTd9NWvdx8GuDnD9ZzaT9X2XrznwA=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1771084338;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=nE+dM/TIuhuNRAqnVffwvNZaV3Ds+VJH22M46P5RvQQ=;\n b=BtWMHUMHfIb2o5gY00KXl0BDl6utE/9JYykoZcLDDthlRP250LdQYjbRqS+6FrNZ5uNubC\n T730WbdjY8L8gekUnoWoFqHhFXOGhqlOYhxQmow0HEQXapwwHy02KLEb4IClzb9tU5biTJ\n A/GZ7Lo/bPXTT3Evkd4TWH2oQPt7Umw=","X-MC-Unique":"idgxDjr7MA2glWR5pW7LBQ-1","X-Mimecast-MFC-AGG-ID":"idgxDjr7MA2glWR5pW7LBQ_1771084333","From":"David Malcolm <dmalcolm@redhat.com>","To":"gcc-patches@gcc.gnu.org, Yangyu Chen <cyy@cyyself.name>,\n Soumya AR <soumyaa@nvidia.com>, jakub@redhat.com,\n Richard Biener <richard.guenther@gmail.com>","Cc":"Alfie Richards <alfie.richards@arm.com>,\n Sandra Loosemore <sloosemore@baylibre.com>,\n Martin Liska <martin.liska@hey.com>,\n Evgeny Stupachenko <evstupac@gmail.com>,\n Alice Carlotti <alice.carlotti@arm.com>,\n Jeff Law <jeffrey.law@oss.qualcomm.com>,\n Jerry DeLisle <jvdelisle@gcc.gnu.org>, Harald Anlauf <anlauf@gmx.de>,\n Paul Thomas <pault@gcc.gnu.org>,\n Richard Sandiford <rdsandiford@googlemail.com>,\n Joseph Myers <josmyers@redhat.com>, Jason Merrill <jason@redhat.com>,\n David Malcolm <dmalcolm@redhat.com>","Subject":"[PATCH 1/5] diagnostics: use label_text for logical_location strings","Date":"Sat, 14 Feb 2026 10:51:57 -0500","Message-ID":"<20260214155201.1049644-2-dmalcolm@redhat.com>","In-Reply-To":"<20260214155201.1049644-1-dmalcolm@redhat.com>","References":"<tencent_048DF6A8630E2E590C79C840A31F1FA86006@qq.com>\n <20260214155201.1049644-1-dmalcolm@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.17","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"4v93qRyBxyYodXmWr9ypUV-8fK716cjqQcS5_mqyXQw_1771084333","X-Mimecast-Originator":"redhat.com","Content-Transfer-Encoding":"8bit","content-type":"text/plain; charset=\"US-ASCII\"; x-default=true","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":"Doing so makes it possible for logical_locations::manager subclasses to\nreturn copies of temporary buffers, rather than requiring\nthe buffer to outlive the call.  This is useful for generating\nJSON pointer strings, for logical locations within JSON files.\n\ngcc/ChangeLog:\n\t* diagnostics/html-sink.cc\n\t(html_builder::make_element_for_diagnostic): Update for logical\n\tlocation strings being returned as  label_text rather than\n\tconst char *.\n\t* diagnostics/logical-locations.h\n\t(logical_locations::manager::get_short_name): Return label_text\n\trather than const char *.\n\t(logical_locations::manager::get_name_with_scope): Likewise.\n\t(logical_locations::manager::get_internal_name): Likewise.\n\t* diagnostics/sarif-sink.cc\n\t(sarif_builder::ensure_sarif_logical_location_for): Update for\n\tlogical location strings being returned as label_text rather than\n\tconst char *.\n\t(sarif_builder::make_minimal_sarif_logical_location): Likewise.\n\t* diagnostics/selftest-logical-locations.cc\n\t(test_manager::get_short_name): Likewise.\n\t(test_manager::get_name_with_scope): Likewise.\n\t(test_manager::get_internal_name): Likewise.\n\t(selftest_logical_locations_cc_tests): Likewise.\n\t* diagnostics/selftest-logical-locations.h\n\t(test_manager::get_short_name): Likewise.\n\t(test_manager::get_name_with_scope): Likewise.\n\t(test_manager::get_internal_name): Likewise.\n\t* diagnostics/state-graphs-to-dot.cc\n\t(state_diagram::on_node_in_table): Likewise.\n\t* libgdiagnostics.cc\n\t(impl_logical_location_manager::get_short_name): Likewise.\n\t(impl_logical_location_manager::get_name_with_scope): Likewise.\n\t(impl_logical_location_manager::get_internal_name): Likewise.\n\t* tree-logical-location.cc\n\t(tree_logical_location_manager::get_short_name): Likewise.\n\t(tree_logical_location_manager::get_name_with_scope): Likewise.\n\t(tree_logical_location_manager::get_internal_name): Likewise.\n\t* tree-logical-location.h\n\t(tree_logical_location_manager::get_short_name): Likewise.\n\t(tree_logical_location_manager::get_name_with_scope): Likewise.\n\t(tree_logical_location_manager::get_internal_name): Likewise.\n\nSigned-off-by: David Malcolm <dmalcolm@redhat.com>\n---\n gcc/diagnostics/html-sink.cc                  | 11 +++++---\n gcc/diagnostics/logical-locations.h           |  6 ++---\n gcc/diagnostics/sarif-sink.cc                 | 24 ++++++++++-------\n gcc/diagnostics/selftest-logical-locations.cc | 18 ++++++-------\n gcc/diagnostics/selftest-logical-locations.h  |  6 ++---\n gcc/diagnostics/state-graphs-to-dot.cc        | 15 ++++++-----\n gcc/libgdiagnostics.cc                        | 21 ++++++++-------\n gcc/tree-logical-location.cc                  | 26 ++++++++++---------\n gcc/tree-logical-location.h                   |  6 ++---\n 9 files changed, 75 insertions(+), 58 deletions(-)","diff":"diff --git a/gcc/diagnostics/html-sink.cc b/gcc/diagnostics/html-sink.cc\nindex f2d5917e2ed92..58442e9a62bcf 100644\n--- a/gcc/diagnostics/html-sink.cc\n+++ b/gcc/diagnostics/html-sink.cc\n@@ -1093,10 +1093,13 @@ html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic,\n \t    enum logical_locations::kind kind\n \t      = logical_loc_mgr->get_kind (logical_loc);;\n \t    if (const char *label = get_label_for_logical_location_kind (kind))\n-\t      if (const char *name_with_scope\n-\t\t  = logical_loc_mgr->get_name_with_scope (logical_loc))\n-\t\tadd_labelled_value (xp, \"logical-location\",\n-\t\t\t\t    label, name_with_scope, true);\n+\t      {\n+\t\tlabel_text name_with_scope\n+\t\t  = logical_loc_mgr->get_name_with_scope (logical_loc);\n+\t\tif (name_with_scope.get ())\n+\t\t  add_labelled_value (xp, \"logical-location\",\n+\t\t\t\t      label, name_with_scope.get (), true);\n+\t      }\n \t    m_last_logical_location = logical_loc;\n \t  }\n \ndiff --git a/gcc/diagnostics/logical-locations.h b/gcc/diagnostics/logical-locations.h\nindex 847843bc800d7..b91f72825251e 100644\n--- a/gcc/diagnostics/logical-locations.h\n+++ b/gcc/diagnostics/logical-locations.h\n@@ -155,15 +155,15 @@ public:\n \n   /* Get a string (or NULL) for K suitable for use by the SARIF logicalLocation\n      \"name\" property (SARIF v2.1.0 section 3.33.4).  */\n-  virtual const char *get_short_name (key k) const = 0;\n+  virtual label_text get_short_name (key k) const = 0;\n \n   /* Get a string (or NULL) for K suitable for use by the SARIF logicalLocation\n      \"fullyQualifiedName\" property (SARIF v2.1.0 section 3.33.5).  */\n-  virtual const char *get_name_with_scope (key k) const = 0;\n+  virtual label_text get_name_with_scope (key k) const = 0;\n \n   /* Get a string (or NULL) for K suitable for use by the SARIF logicalLocation\n      \"decoratedName\" property (SARIF v2.1.0 section 3.33.6).  */\n-  virtual const char *get_internal_name (key k) const = 0;\n+  virtual label_text get_internal_name (key k) const = 0;\n \n   /* Get what kind of SARIF logicalLocation K is (if any).  */\n   virtual enum kind get_kind (key k) const = 0;\ndiff --git a/gcc/diagnostics/sarif-sink.cc b/gcc/diagnostics/sarif-sink.cc\nindex 2cd64d65112e9..1e25b459c645f 100644\n--- a/gcc/diagnostics/sarif-sink.cc\n+++ b/gcc/diagnostics/sarif-sink.cc\n@@ -3063,16 +3063,20 @@ ensure_sarif_logical_location_for (logical_locations::key k)\n \n   auto sarif_logical_loc = std::make_unique<sarif_logical_location> ();\n \n-  if (const char *short_name = logical_loc_mgr->get_short_name (k))\n-    sarif_logical_loc->set_string (\"name\", short_name);\n+  label_text short_name = logical_loc_mgr->get_short_name (k);\n+  if (short_name.get ())\n+    sarif_logical_loc->set_string (\"name\", short_name.get ());\n \n   /* \"fullyQualifiedName\" property (SARIF v2.1.0 section 3.33.5).  */\n-  if (const char *name_with_scope = logical_loc_mgr->get_name_with_scope (k))\n-    sarif_logical_loc->set_string (\"fullyQualifiedName\", name_with_scope);\n+  label_text name_with_scope = logical_loc_mgr->get_name_with_scope (k);\n+  if (name_with_scope.get ())\n+    sarif_logical_loc->set_string (\"fullyQualifiedName\",\n+\t\t\t\t   name_with_scope.get ());\n \n   /* \"decoratedName\" property (SARIF v2.1.0 section 3.33.6).  */\n-  if (const char *internal_name = logical_loc_mgr->get_internal_name (k))\n-    sarif_logical_loc->set_string (\"decoratedName\", internal_name);\n+  label_text internal_name = logical_loc_mgr->get_internal_name (k);\n+  if (internal_name.get ())\n+    sarif_logical_loc->set_string (\"decoratedName\", internal_name.get ());\n \n   /* \"kind\" property (SARIF v2.1.0 section 3.33.7).  */\n   enum logical_locations::kind kind = logical_loc_mgr->get_kind (k);\n@@ -3118,9 +3122,11 @@ make_minimal_sarif_logical_location (logical_locations::key logical_loc)\n   sarif_logical_loc->set_integer (\"index\", index);\n \n   /* \"fullyQualifiedName\" property (SARIF v2.1.0 section 3.33.5).  */\n-  if (const char *name_with_scope\n-\t= logical_loc_mgr->get_name_with_scope (logical_loc))\n-    sarif_logical_loc->set_string (\"fullyQualifiedName\", name_with_scope);\n+  label_text name_with_scope\n+    = logical_loc_mgr->get_name_with_scope (logical_loc);\n+  if (name_with_scope.get ())\n+    sarif_logical_loc->set_string (\"fullyQualifiedName\",\n+\t\t\t\t   name_with_scope.get ());\n \n   return sarif_logical_loc;\n }\ndiff --git a/gcc/diagnostics/selftest-logical-locations.cc b/gcc/diagnostics/selftest-logical-locations.cc\nindex f2176e331331b..3a0ee7f20ddf1 100644\n--- a/gcc/diagnostics/selftest-logical-locations.cc\n+++ b/gcc/diagnostics/selftest-logical-locations.cc\n@@ -45,27 +45,27 @@ test_manager::dump (FILE *outfile, int indent) const\n   dumping::emit_heading (outfile, indent, \"test_manager\");\n }\n \n-const char *\n+label_text\n test_manager::get_short_name (key k) const\n {\n   auto item = item_from_key (k);\n   if (!item)\n-    return nullptr;\n-  return item->m_name;\n+    return label_text ();\n+  return label_text::borrow (item->m_name);\n }\n \n-const char *\n+label_text\n test_manager::get_name_with_scope (key k) const\n {\n   auto item = item_from_key (k);\n-  return item->m_name;\n+  return label_text::borrow (item->m_name);\n }\n \n-const char *\n+label_text\n test_manager::get_internal_name (key k) const\n {\n   auto item = item_from_key (k);\n-  return item->m_name;\n+  return label_text::borrow (item->m_name);\n }\n \n enum diagnostics::logical_locations::kind\n@@ -118,8 +118,8 @@ selftest_logical_locations_cc_tests ()\n \n   ASSERT_NE (loc_foo, loc_bar);\n \n-  ASSERT_STREQ (mgr.get_short_name (loc_foo), \"foo\");\n-  ASSERT_STREQ (mgr.get_short_name (loc_bar), \"bar\");\n+  ASSERT_STREQ (mgr.get_short_name (loc_foo).get (), \"foo\");\n+  ASSERT_STREQ (mgr.get_short_name (loc_bar).get (), \"bar\");\n }\n \n } // namespace diagnostics::logical_locations::selftest\ndiff --git a/gcc/diagnostics/selftest-logical-locations.h b/gcc/diagnostics/selftest-logical-locations.h\nindex bc01894df82b9..2d00871fc2124 100644\n--- a/gcc/diagnostics/selftest-logical-locations.h\n+++ b/gcc/diagnostics/selftest-logical-locations.h\n@@ -41,9 +41,9 @@ public:\n \n   void dump (FILE *out, int indent) const final override;\n \n-  const char *get_short_name (key) const final override;\n-  const char *get_name_with_scope (key) const final override;\n-  const char *get_internal_name (key) const final override;\n+  label_text get_short_name (key) const final override;\n+  label_text get_name_with_scope (key) const final override;\n+  label_text get_internal_name (key) const final override;\n   kind get_kind (key) const final override;\n   label_text get_name_for_path_output (key) const final override;\n   key get_parent (key) const final override\ndiff --git a/gcc/diagnostics/state-graphs-to-dot.cc b/gcc/diagnostics/state-graphs-to-dot.cc\nindex fe5a07fd02dcf..a0ccec71ed29a 100644\n--- a/gcc/diagnostics/state-graphs-to-dot.cc\n+++ b/gcc/diagnostics/state-graphs-to-dot.cc\n@@ -324,12 +324,15 @@ private:\n \tbreak;\n       case state_node_properties::kind_t::stack_frame:\n \tif (auto logical_loc = state_node.get_logical_loc ())\n-\t  if (const char *function\n-\t\t= m_logical_loc_mgr.get_short_name (logical_loc))\n-\t    add_title_tr (id_of_dot_node, xp, num_columns, state_node,\n-\t\t\t  std::string (\"Frame: \") + function,\n-\t\t\t  style::h2,\n-\t\t\t  state_node_properties::dynalloc_state_t::unknown);\n+\t  {\n+\t    label_text function\n+\t      = m_logical_loc_mgr.get_short_name (logical_loc);\n+\t    if (function.get ())\n+\t      add_title_tr (id_of_dot_node, xp, num_columns, state_node,\n+\t\t\t    std::string (\"Frame: \") + function.get (),\n+\t\t\t    style::h2,\n+\t\t\t    state_node_properties::dynalloc_state_t::unknown);\n+\t  }\n \tbreak;\n       case state_node_properties::kind_t::dynalloc_buffer:\n \t{\ndiff --git a/gcc/libgdiagnostics.cc b/gcc/libgdiagnostics.cc\nindex 98e15bfec11e7..eb2d0ac4cac1a 100644\n--- a/gcc/libgdiagnostics.cc\n+++ b/gcc/libgdiagnostics.cc\n@@ -485,28 +485,31 @@ public:\n       (outfile, indent, \"impl_logical_location_manager\");\n   }\n \n-  const char *get_short_name (key k) const final override\n+  label_text\n+  get_short_name (key k) const final override\n   {\n     if (auto loc = ptr_from_key (k))\n-      return loc->m_short_name.get_str ();\n+      return label_text::borrow (loc->m_short_name.get_str ());\n     else\n-      return nullptr;\n+      return label_text ();\n   }\n \n-  const char *get_name_with_scope (key k) const final override\n+  label_text\n+  get_name_with_scope (key k) const final override\n   {\n     if (auto loc = ptr_from_key (k))\n-      return loc->m_fully_qualified_name.get_str ();\n+      return label_text::borrow (loc->m_fully_qualified_name.get_str ());\n     else\n-      return nullptr;\n+      return label_text ();\n   }\n \n-  const char *get_internal_name (key k) const final override\n+  label_text\n+  get_internal_name (key k) const final override\n   {\n     if (auto loc = ptr_from_key (k))\n-      return loc->m_decorated_name.get_str ();\n+      return label_text::borrow (loc->m_decorated_name.get_str ());\n     else\n-      return nullptr;\n+      return label_text ();\n   }\n \n   kind get_kind (key k) const final override\ndiff --git a/gcc/tree-logical-location.cc b/gcc/tree-logical-location.cc\nindex 71294875c99c1..b741b4e8af361 100644\n--- a/gcc/tree-logical-location.cc\n+++ b/gcc/tree-logical-location.cc\n@@ -48,33 +48,35 @@ tree_logical_location_manager::dump (FILE *outfile, int indent) const\n \t\t\t\t      \"tree_logical_location_manager\");\n }\n \n-const char *\n+label_text\n tree_logical_location_manager::get_short_name (key k) const\n {\n   tree node = tree_from_key (k);\n   assert_valid_tree (node);\n \n   if (DECL_P (node))\n-    return identifier_to_locale (lang_hooks.decl_printable_name (node, 0));\n+    return label_text::borrow\n+      (identifier_to_locale (lang_hooks.decl_printable_name (node, 0)));\n   if (TYPE_P (node))\n-    return IDENTIFIER_POINTER (TYPE_IDENTIFIER (node));\n-  return nullptr;\n+    return label_text::borrow (IDENTIFIER_POINTER (TYPE_IDENTIFIER (node)));\n+  return label_text ();\n }\n \n-const char *\n+label_text\n tree_logical_location_manager::get_name_with_scope (key k) const\n {\n   tree node = tree_from_key (k);\n   assert_valid_tree (node);\n \n   if (DECL_P (node))\n-    return identifier_to_locale (lang_hooks.decl_printable_name (node, 1));\n+    return label_text::borrow\n+      (identifier_to_locale (lang_hooks.decl_printable_name (node, 1)));\n   if (TYPE_P (node))\n-    return nullptr;\n-  return nullptr;\n+    return label_text ();\n+  return label_text ();\n }\n \n-const char *\n+label_text\n tree_logical_location_manager::get_internal_name (key k) const\n {\n   tree node = tree_from_key (k);\n@@ -85,11 +87,11 @@ tree_logical_location_manager::get_internal_name (key k) const\n       if (HAS_DECL_ASSEMBLER_NAME_P (node)\n \t  && TREE_CODE (node) != NAMESPACE_DECL) // FIXME\n \tif (tree id = DECL_ASSEMBLER_NAME (node))\n-\t  return IDENTIFIER_POINTER (id);\n+\t  return label_text::borrow (IDENTIFIER_POINTER (id));\n     }\n   else if (TYPE_P (node))\n-    return nullptr;\n-  return NULL;\n+    return label_text ();\n+  return label_text ();\n }\n \n enum kind\ndiff --git a/gcc/tree-logical-location.h b/gcc/tree-logical-location.h\nindex 037496010505f..7a37480bee026 100644\n--- a/gcc/tree-logical-location.h\n+++ b/gcc/tree-logical-location.h\n@@ -36,9 +36,9 @@ public:\n \n   void dump (FILE *out, int indent) const final override;\n \n-  const char *get_short_name (key) const final override;\n-  const char *get_name_with_scope (key) const final override;\n-  const char *get_internal_name (key) const final override;\n+  label_text get_short_name (key) const final override;\n+  label_text get_name_with_scope (key) const final override;\n+  label_text get_internal_name (key) const final override;\n   kind get_kind (key) const final override;\n   label_text get_name_for_path_output (key) const final override;\n   key get_parent (key) const final override;\n","prefixes":["1/5"]}