================ @@ -0,0 +1,108 @@ +//===- CIRLoweringEmitter.cpp - Generate lowering of builtins --=-*- C++ -*--=// +// +// 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 "TableGenBackends.h" +#include "llvm/TableGen/TableGenBackend.h" + +using namespace llvm; + +namespace { +std::string ClassDeclaration; +std::string ClassDefinitions; +std::string ClassList; + +// Adapted from mlir/lib/TableGen/Operator.cpp +// Returns the C++ class name of the operation, which is the name of the +// operation with the dialect prefix removed and the first underscore removed. +// If the operation name starts with an underscore, the underscore is considered +// part of the class name. +std::string getCppClassName(const Record *Operation) { + StringRef Name = Operation->getName(); + auto [prefix, cppClassName] = Name.split('_'); + if (prefix.empty()) { + // Class name with a leading underscore and without dialect prefix + return Name.str(); + } + + if (cppClassName.empty()) { ---------------- bcardosolopes wrote:
No curlies needed here. https://github.com/llvm/llvm-project/pull/151750 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits