//===- Class.cpp - Helper classes for Op C++ code emission --------------===// // // 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/TableGen/Class.h" #include "mlir/TableGen/Format.h" #include "llvm/ADT/Sequence.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/Debug.h" usingnamespacemlir; usingnamespacemlir::tblgen; /// Returns space to be emitted after the given C++ `type`. return "" if the /// ends with '&' or '*', or is empty, else returns " ". static StringRef getSpaceAfterType(StringRef type) { … } //===----------------------------------------------------------------------===// // MethodParameter definitions //===----------------------------------------------------------------------===// void MethodParameter::writeDeclTo(raw_indented_ostream &os) const { … } void MethodParameter::writeDefTo(raw_indented_ostream &os) const { … } //===----------------------------------------------------------------------===// // MethodParameters definitions //===----------------------------------------------------------------------===// void MethodParameters::writeDeclTo(raw_indented_ostream &os) const { … } void MethodParameters::writeDefTo(raw_indented_ostream &os) const { … } bool MethodParameters::subsumes(const MethodParameters &other) const { … } //===----------------------------------------------------------------------===// // MethodSignature definitions //===----------------------------------------------------------------------===// bool MethodSignature::makesRedundant(const MethodSignature &other) const { … } void MethodSignature::writeDeclTo(raw_indented_ostream &os) const { … } void MethodSignature::writeDefTo(raw_indented_ostream &os, StringRef namePrefix) const { … } void MethodSignature::writeTemplateParamsTo( mlir::raw_indented_ostream &os) const { … } //===----------------------------------------------------------------------===// // MethodBody definitions //===----------------------------------------------------------------------===// MethodBody::MethodBody(bool declOnly) : … { … } void MethodBody::writeTo(raw_indented_ostream &os) const { … } //===----------------------------------------------------------------------===// // Method definitions //===----------------------------------------------------------------------===// void Method::writeDeclTo(raw_indented_ostream &os) const { … } void Method::writeDefTo(raw_indented_ostream &os, StringRef namePrefix) const { … } //===----------------------------------------------------------------------===// // Constructor definitions //===----------------------------------------------------------------------===// void Constructor::writeDeclTo(raw_indented_ostream &os) const { … } void Constructor::writeDefTo(raw_indented_ostream &os, StringRef namePrefix) const { … } void Constructor::MemberInitializer::writeTo(raw_indented_ostream &os) const { … } //===----------------------------------------------------------------------===// // Visibility definitions //===----------------------------------------------------------------------===// namespace mlir { namespace tblgen { raw_ostream &operator<<(raw_ostream &os, Visibility visibility) { … } } // namespace tblgen } // namespace mlir //===----------------------------------------------------------------------===// // ParentClass definitions //===----------------------------------------------------------------------===// void ParentClass::writeTo(raw_indented_ostream &os) const { … } //===----------------------------------------------------------------------===// // UsingDeclaration definitions //===----------------------------------------------------------------------===// void UsingDeclaration::writeDeclTo(raw_indented_ostream &os) const { … } //===----------------------------------------------------------------------===// // Field definitions //===----------------------------------------------------------------------===// void Field::writeDeclTo(raw_indented_ostream &os) const { … } //===----------------------------------------------------------------------===// // VisibilityDeclaration definitions //===----------------------------------------------------------------------===// void VisibilityDeclaration::writeDeclTo(raw_indented_ostream &os) const { … } //===----------------------------------------------------------------------===// // ExtraClassDeclaration definitions //===----------------------------------------------------------------------===// void ExtraClassDeclaration::writeDeclTo(raw_indented_ostream &os) const { … } void ExtraClassDeclaration::writeDefTo(raw_indented_ostream &os, StringRef namePrefix) const { … } //===----------------------------------------------------------------------===// // Class definitions //===----------------------------------------------------------------------===// ParentClass &Class::addParent(ParentClass parent) { … } void Class::writeDeclTo(raw_indented_ostream &os) const { … } void Class::writeDefTo(raw_indented_ostream &os) const { … } void Class::finalize() { … } Visibility Class::getLastVisibilityDecl() const { … } Method *insertAndPruneMethods(std::vector<std::unique_ptr<Method>> &methods, std::unique_ptr<Method> newMethod) { … } Method *Class::addMethodAndPrune(Method &&newMethod) { … } Constructor *Class::addConstructorAndPrune(Constructor &&newCtor) { … }