1 | //===- Constraint.cpp -----------------------------------------------------===// |
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 | |
9 | #include "mlir/Tools/PDLL/ODS/Constraint.h" |
10 | |
11 | using namespace mlir; |
12 | using namespace mlir::pdll::ods; |
13 | |
14 | //===----------------------------------------------------------------------===// |
15 | // Constraint |
16 | //===----------------------------------------------------------------------===// |
17 | |
18 | StringRef Constraint::getDemangledName() const { |
19 | StringRef demangledName = name; |
20 | |
21 | // Drop the "anonymous" suffix if present. |
22 | size_t anonymousSuffix = demangledName.find(Str: "(anonymous_" ); |
23 | if (anonymousSuffix != StringRef::npos) |
24 | demangledName = demangledName.take_front(N: anonymousSuffix); |
25 | return demangledName; |
26 | } |
27 | |