xref: /freebsd/contrib/llvm-project/lld/Common/Utils.cpp (revision 2c2ec6bbc9cc7762a250ffe903bda6c2e44d25ff)
1 //===- Utils.cpp ------------------------------------------------*- C++-*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //===----------------------------------------------------------------------===//
7 //
8 // The file defines utils functions that can be shared across archs.
9 //
10 //===----------------------------------------------------------------------===//
11 
12 #include "lld/Common/Utils.h"
13 
14 using namespace llvm;
15 using namespace lld;
16 
17 StringRef lld::utils::getRootSymbol(StringRef name) {
18   name.consume_back(".Tgm");
19   auto [P0, S0] = name.rsplit(".llvm.");
20   auto [P1, S1] = P0.rsplit(".__uniq.");
21   return P1;
22 }
23