summaryrefslogtreecommitdiff
path: root/mlir/lib/Tools/PDLL/ODS/Constraint.cpp
blob: c9471f984e41413d3aab6e46a942b2e8cd6c2f90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//===- Constraint.cpp -----------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "mlir/Tools/PDLL/ODS/Constraint.h"

using namespace mlir;
using namespace mlir::pdll::ods;

//===----------------------------------------------------------------------===//
// Constraint
//===----------------------------------------------------------------------===//

StringRef Constraint::getDemangledName() const {
  StringRef demangledName = name;

  // Drop the "anonymous" suffix if present.
  size_t anonymousSuffix = demangledName.find("(anonymous_");
  if (anonymousSuffix != StringRef::npos)
    demangledName = demangledName.take_front(anonymousSuffix);
  return demangledName;
}