#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/Types.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
usingnamespacemlir;
usingnamespacemlir::detail;
DiagnosticArgument::DiagnosticArgument(Attribute attr)
: … { … }
DiagnosticArgument::DiagnosticArgument(Type val)
: … { … }
Attribute DiagnosticArgument::getAsAttribute() const { … }
Type DiagnosticArgument::getAsType() const { … }
void DiagnosticArgument::print(raw_ostream &os) const { … }
static StringRef twineToStrRef(const Twine &val,
std::vector<std::unique_ptr<char[]>> &strings) { … }
Diagnostic &Diagnostic::operator<<(char val) { … }
Diagnostic &Diagnostic::operator<<(const Twine &val) { … }
Diagnostic &Diagnostic::operator<<(Twine &&val) { … }
Diagnostic &Diagnostic::operator<<(StringAttr val) { … }
Diagnostic &Diagnostic::operator<<(OperationName val) { … }
static OpPrintingFlags adjustPrintingFlags(OpPrintingFlags flags,
DiagnosticSeverity severity) { … }
Diagnostic &Diagnostic::operator<<(Operation &op) { … }
Diagnostic &Diagnostic::appendOp(Operation &op, const OpPrintingFlags &flags) { … }
Diagnostic &Diagnostic::operator<<(Value val) { … }
void Diagnostic::print(raw_ostream &os) const { … }
std::string Diagnostic::str() const { … }
Diagnostic &Diagnostic::attachNote(std::optional<Location> noteLoc) { … }
operator LogicalResult()
operator LogicalResult()
void InFlightDiagnostic::report() { … }
void InFlightDiagnostic::abandon() { … }
namespace mlir {
namespace detail {
struct DiagnosticEngineImpl { … };
}
}
void DiagnosticEngineImpl::emit(Diagnostic &&diag) { … }
DiagnosticEngine::DiagnosticEngine() : … { … }
DiagnosticEngine::~DiagnosticEngine() = default;
auto DiagnosticEngine::registerHandler(HandlerTy handler) -> HandlerID { … }
void DiagnosticEngine::eraseHandler(HandlerID handlerID) { … }
void DiagnosticEngine::emit(Diagnostic &&diag) { … }
static InFlightDiagnostic
emitDiag(Location location, DiagnosticSeverity severity, const Twine &message) { … }
InFlightDiagnostic mlir::emitError(Location loc) { … }
InFlightDiagnostic mlir::emitError(Location loc, const Twine &message) { … }
InFlightDiagnostic mlir::emitWarning(Location loc) { … }
InFlightDiagnostic mlir::emitWarning(Location loc, const Twine &message) { … }
InFlightDiagnostic mlir::emitRemark(Location loc) { … }
InFlightDiagnostic mlir::emitRemark(Location loc, const Twine &message) { … }
ScopedDiagnosticHandler::~ScopedDiagnosticHandler() { … }
namespace mlir {
namespace detail {
struct SourceMgrDiagnosticHandlerImpl { … };
}
}
static std::optional<CallSiteLoc> getCallSiteLoc(Location loc) { … }
static llvm::SourceMgr::DiagKind getDiagKind(DiagnosticSeverity kind) { … }
SourceMgrDiagnosticHandler::SourceMgrDiagnosticHandler(
llvm::SourceMgr &mgr, MLIRContext *ctx, raw_ostream &os,
ShouldShowLocFn &&shouldShowLocFn)
: … { … }
SourceMgrDiagnosticHandler::SourceMgrDiagnosticHandler(
llvm::SourceMgr &mgr, MLIRContext *ctx, ShouldShowLocFn &&shouldShowLocFn)
: … { … }
SourceMgrDiagnosticHandler::~SourceMgrDiagnosticHandler() = default;
void SourceMgrDiagnosticHandler::emitDiagnostic(Location loc, Twine message,
DiagnosticSeverity kind,
bool displaySourceLine) { … }
void SourceMgrDiagnosticHandler::emitDiagnostic(Diagnostic &diag) { … }
const llvm::MemoryBuffer *
SourceMgrDiagnosticHandler::getBufferForFile(StringRef filename) { … }
std::optional<Location>
SourceMgrDiagnosticHandler::findLocToShow(Location loc) { … }
SMLoc SourceMgrDiagnosticHandler::convertLocToSMLoc(FileLineColLoc loc) { … }
namespace mlir {
namespace detail {
struct ExpectedDiag { … };
struct SourceMgrDiagnosticVerifierHandlerImpl { … };
}
}
static StringRef getDiagKindStr(DiagnosticSeverity kind) { … }
std::optional<MutableArrayRef<ExpectedDiag>>
SourceMgrDiagnosticVerifierHandlerImpl::getExpectedDiags(StringRef bufName) { … }
MutableArrayRef<ExpectedDiag>
SourceMgrDiagnosticVerifierHandlerImpl::computeExpectedDiags(
raw_ostream &os, llvm::SourceMgr &mgr, const llvm::MemoryBuffer *buf) { … }
SourceMgrDiagnosticVerifierHandler::SourceMgrDiagnosticVerifierHandler(
llvm::SourceMgr &srcMgr, MLIRContext *ctx, raw_ostream &out)
: … { … }
SourceMgrDiagnosticVerifierHandler::SourceMgrDiagnosticVerifierHandler(
llvm::SourceMgr &srcMgr, MLIRContext *ctx)
: … { … }
SourceMgrDiagnosticVerifierHandler::~SourceMgrDiagnosticVerifierHandler() { … }
LogicalResult SourceMgrDiagnosticVerifierHandler::verify() { … }
void SourceMgrDiagnosticVerifierHandler::process(Diagnostic &diag) { … }
void SourceMgrDiagnosticVerifierHandler::process(FileLineColLoc loc,
StringRef msg,
DiagnosticSeverity kind) { … }
namespace mlir {
namespace detail {
struct ParallelDiagnosticHandlerImpl : public llvm::PrettyStackTraceEntry { … };
}
}
ParallelDiagnosticHandler::ParallelDiagnosticHandler(MLIRContext *ctx)
: … { … }
ParallelDiagnosticHandler::~ParallelDiagnosticHandler() = default;
void ParallelDiagnosticHandler::setOrderIDForThread(size_t orderID) { … }
void ParallelDiagnosticHandler::eraseOrderIDForThread() { … }