llvm/mlir/test/lib/IR/TestOpaqueLoc.cpp

//===- TestOpaqueLoc.cpp - Pass to test opaque locations ------------------===//
//
// 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/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Pass/Pass.h"

usingnamespacemlir;

namespace {
/// A simple structure which is used for testing as an underlying location in
/// OpaqueLoc.
struct MyLocation {};
} // namespace

MLIR_DECLARE_EXPLICIT_TYPE_ID(MyLocation *)
MLIR_DEFINE_EXPLICIT_TYPE_ID(MyLocation *)

namespace {
/// Pass that changes locations to opaque locations for each operation.
/// It also takes all operations that are not function operations or
/// terminators and clones them with opaque locations which store the initial
/// locations.
struct TestOpaqueLoc
    : public PassWrapper<TestOpaqueLoc, OperationPass<ModuleOp>> {};

} // namespace

namespace mlir {
namespace test {
void registerTestOpaqueLoc() {}
} // namespace test
} // namespace mlir