xref: /llvm-project/mlir/lib/Tools/PDLL/ODS/Constraint.cpp (revision b3fc0fa84a09540d8fc7214899021acbf2fd6ff8)
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 
getDemangledName() const18 StringRef Constraint::getDemangledName() const {
19   StringRef demangledName = name;
20 
21   // Drop the "anonymous" suffix if present.
22   size_t anonymousSuffix = demangledName.find("(anonymous_");
23   if (anonymousSuffix != StringRef::npos)
24     demangledName = demangledName.take_front(anonymousSuffix);
25   return demangledName;
26 }
27