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(Suffix: ".Tgm" ); |
19 | auto [P0, S0] = name.rsplit(Separator: ".llvm." ); |
20 | auto [P1, S1] = P0.rsplit(Separator: ".__uniq." ); |
21 | return P1; |
22 | } |
23 | |