From 6a6cb40f23cec59e7b3e386e0f0f958e52590ddc Mon Sep 17 00:00:00 2001 From: River Riddle Date: Mon, 13 May 2019 09:00:22 -0700 Subject: [PATCH] Refactor the includes of Function.h now that the dependency on Operation has been removed. The dependency was on the op casting methods, which have now moved out of Operation, used by the walker. -- PiperOrigin-RevId: 247944666 --- mlir/include/mlir/Analysis/NestedMatcher.h | 1 + mlir/include/mlir/IR/Function.h | 16 +++++++++++----- mlir/lib/IR/Attributes.cpp | 2 ++ mlir/lib/IR/Function.cpp | 8 +++++--- mlir/lib/IR/MLIRContext.cpp | 1 + 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/mlir/include/mlir/Analysis/NestedMatcher.h b/mlir/include/mlir/Analysis/NestedMatcher.h index a86cf94..3ab24f8 100644 --- a/mlir/include/mlir/Analysis/NestedMatcher.h +++ b/mlir/include/mlir/Analysis/NestedMatcher.h @@ -19,6 +19,7 @@ #define MLIR_ANALYSIS_MLFUNCTIONMATCHER_H_ #include "mlir/IR/Function.h" +#include "mlir/IR/Operation.h" #include "llvm/Support/Allocator.h" namespace mlir { diff --git a/mlir/include/mlir/IR/Function.h b/mlir/include/mlir/IR/Function.h index d4b85b5..24cdb4a 100644 --- a/mlir/include/mlir/IR/Function.h +++ b/mlir/include/mlir/IR/Function.h @@ -22,7 +22,10 @@ #ifndef MLIR_IR_FUNCTION_H #define MLIR_IR_FUNCTION_H -#include "mlir/IR/Operation.h" +#include "mlir/IR/Attributes.h" +#include "mlir/IR/Block.h" +#include "mlir/IR/Identifier.h" +#include "mlir/IR/Location.h" namespace mlir { class BlockAndValueMapping; @@ -245,15 +248,18 @@ public: /// Emit an error about fatal conditions with this function, reporting up to /// any diagnostic handlers that may be listening. - InFlightDiagnostic emitError(const Twine &message = {}); + InFlightDiagnostic emitError(); + InFlightDiagnostic emitError(const Twine &message); /// Emit a warning about this function, reporting up to any diagnostic /// handlers that may be listening. - InFlightDiagnostic emitWarning(const Twine &message = {}); + InFlightDiagnostic emitWarning(); + InFlightDiagnostic emitWarning(const Twine &message); /// Emit a remark about this function, reporting up to any diagnostic /// handlers that may be listening. - InFlightDiagnostic emitRemark(const Twine &message = {}); + InFlightDiagnostic emitRemark(); + InFlightDiagnostic emitRemark(const Twine &message); /// Displays the CFG in a window. This is for use from the debugger and /// depends on Graphviz to generate the graph. @@ -362,4 +368,4 @@ private: }; } // end namespace llvm -#endif // MLIR_IR_FUNCTION_H +#endif // MLIR_IR_FUNCTION_H diff --git a/mlir/lib/IR/Attributes.cpp b/mlir/lib/IR/Attributes.cpp index bf1972c..401b995 100644 --- a/mlir/lib/IR/Attributes.cpp +++ b/mlir/lib/IR/Attributes.cpp @@ -18,10 +18,12 @@ #include "mlir/IR/Attributes.h" #include "AttributeDetail.h" #include "mlir/IR/AffineMap.h" +#include "mlir/IR/Diagnostics.h" #include "mlir/IR/Dialect.h" #include "mlir/IR/Function.h" #include "mlir/IR/IntegerSet.h" #include "mlir/IR/Types.h" +#include "llvm/ADT/Twine.h" using namespace mlir; using namespace mlir::detail; diff --git a/mlir/lib/IR/Function.cpp b/mlir/lib/IR/Function.cpp index 1f9a1f5..0d44fa5 100644 --- a/mlir/lib/IR/Function.cpp +++ b/mlir/lib/IR/Function.cpp @@ -16,15 +16,14 @@ // ============================================================================= #include "mlir/IR/Function.h" -#include "mlir/IR/Attributes.h" #include "mlir/IR/BlockAndValueMapping.h" #include "mlir/IR/Diagnostics.h" #include "mlir/IR/MLIRContext.h" #include "mlir/IR/Module.h" -#include "mlir/IR/Types.h" #include "llvm/ADT/MapVector.h" #include "llvm/ADT/SmallString.h" -#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/Twine.h" + using namespace mlir; Function::Function(Location location, StringRef name, FunctionType type, @@ -118,18 +117,21 @@ void Function::erase() { /// any diagnostic handlers that may be listening. This function always /// returns failure. NOTE: This may terminate the containing application, only /// use when the IR is in an inconsistent state. +InFlightDiagnostic Function::emitError() { return emitError({}); } InFlightDiagnostic Function::emitError(const Twine &message) { return getContext()->emitError(getLoc(), message); } /// Emit a warning about this function, reporting up to any diagnostic /// handlers that may be listening. +InFlightDiagnostic Function::emitWarning() { return emitWarning({}); } InFlightDiagnostic Function::emitWarning(const Twine &message) { return getContext()->emitWarning(getLoc(), message); } /// Emit a remark about this function, reporting up to any diagnostic /// handlers that may be listening. +InFlightDiagnostic Function::emitRemark() { return emitRemark({}); } InFlightDiagnostic Function::emitRemark(const Twine &message) { return getContext()->emitRemark(getLoc(), message); } diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp index a4cc076..3df3aea 100644 --- a/mlir/lib/IR/MLIRContext.cpp +++ b/mlir/lib/IR/MLIRContext.cpp @@ -38,6 +38,7 @@ #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/StringMap.h" +#include "llvm/ADT/Twine.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/RWMutex.h" #include "llvm/Support/raw_ostream.h" -- 2.7.4