forked from OSchip/llvm-project
NFC: Uniformize the return of the LocationAttr 'get' methods to 'Location'.
PiperOrigin-RevId: 255078768
This commit is contained in:
parent
4842b2d42e
commit
49162524d8
|
@ -113,7 +113,7 @@ private:
|
|||
llvm::ScopedHashTable<StringRef, mlir::Value *> symbolTable;
|
||||
|
||||
/// Helper conversion for a Toy AST location to an MLIR location.
|
||||
mlir::FileLineColLoc loc(Location loc) {
|
||||
mlir::Location loc(Location loc) {
|
||||
return mlir::FileLineColLoc::get(mlir::Identifier::get(*loc.file, &context),
|
||||
loc.line, loc.col, &context);
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ private:
|
|||
llvm::ScopedHashTable<StringRef, mlir::Value *> symbolTable;
|
||||
|
||||
/// Helper conversion for a Toy AST location to an MLIR location.
|
||||
mlir::FileLineColLoc loc(Location loc) {
|
||||
mlir::Location loc(Location loc) {
|
||||
return mlir::FileLineColLoc::get(mlir::Identifier::get(*loc.file, &context),
|
||||
loc.line, loc.col, &context);
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ private:
|
|||
llvm::ScopedHashTable<StringRef, mlir::Value *> symbolTable;
|
||||
|
||||
/// Helper conversion for a Toy AST location to an MLIR location.
|
||||
mlir::FileLineColLoc loc(Location loc) {
|
||||
mlir::Location loc(Location loc) {
|
||||
return mlir::FileLineColLoc::get(mlir::Identifier::get(*loc.file, &context),
|
||||
loc.line, loc.col, &context);
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ private:
|
|||
llvm::ScopedHashTable<StringRef, mlir::Value *> symbolTable;
|
||||
|
||||
/// Helper conversion for a Toy AST location to an MLIR location.
|
||||
mlir::FileLineColLoc loc(Location loc) {
|
||||
mlir::Location loc(Location loc) {
|
||||
return mlir::FileLineColLoc::get(mlir::Identifier::get(*loc.file, &context),
|
||||
loc.line, loc.col, &context);
|
||||
}
|
||||
|
|
|
@ -65,9 +65,9 @@ public:
|
|||
Module *createModule();
|
||||
|
||||
// Locations.
|
||||
UnknownLoc getUnknownLoc();
|
||||
FileLineColLoc getFileLineColLoc(Identifier filename, unsigned line,
|
||||
unsigned column);
|
||||
Location getUnknownLoc();
|
||||
Location getFileLineColLoc(Identifier filename, unsigned line,
|
||||
unsigned column);
|
||||
Location getFusedLoc(ArrayRef<Location> locs,
|
||||
Attribute metadata = Attribute());
|
||||
|
||||
|
|
|
@ -109,14 +109,13 @@ public:
|
|||
using Base::Base;
|
||||
|
||||
/// Return a uniqued call location object.
|
||||
static CallSiteLoc get(Location callee, Location caller,
|
||||
MLIRContext *context);
|
||||
static Location get(Location callee, Location caller, MLIRContext *context);
|
||||
|
||||
/// Return a call site location which represents a name reference in one line
|
||||
/// or a stack of frames. The input frames are ordered from innermost to
|
||||
/// outermost.
|
||||
static CallSiteLoc get(Location name, ArrayRef<Location> frames,
|
||||
MLIRContext *context);
|
||||
static Location get(Location name, ArrayRef<Location> frames,
|
||||
MLIRContext *context);
|
||||
|
||||
/// The concrete location information this object presents.
|
||||
Location getCallee() const;
|
||||
|
@ -140,10 +139,10 @@ public:
|
|||
using Base::Base;
|
||||
|
||||
/// Return a uniqued FileLineCol location object.
|
||||
static FileLineColLoc get(Identifier filename, unsigned line, unsigned column,
|
||||
MLIRContext *context);
|
||||
static FileLineColLoc get(StringRef filename, unsigned line, unsigned column,
|
||||
MLIRContext *context);
|
||||
static Location get(Identifier filename, unsigned line, unsigned column,
|
||||
MLIRContext *context);
|
||||
static Location get(StringRef filename, unsigned line, unsigned column,
|
||||
MLIRContext *context);
|
||||
|
||||
StringRef getFilename() const;
|
||||
|
||||
|
@ -166,9 +165,9 @@ public:
|
|||
/// Return a uniqued Fused Location object. The first location in the list
|
||||
/// will get precedence during diagnostic emission, with the rest being
|
||||
/// displayed as supplementary "fused from here" style notes.
|
||||
static LocationAttr get(ArrayRef<Location> locs, Attribute metadata,
|
||||
MLIRContext *context);
|
||||
static LocationAttr get(ArrayRef<Location> locs, MLIRContext *context) {
|
||||
static Location get(ArrayRef<Location> locs, Attribute metadata,
|
||||
MLIRContext *context);
|
||||
static Location get(ArrayRef<Location> locs, MLIRContext *context) {
|
||||
return get(locs, Attribute(), context);
|
||||
}
|
||||
|
||||
|
@ -192,10 +191,10 @@ public:
|
|||
|
||||
/// Return a uniqued name location object. The child location must not be
|
||||
/// another NameLoc.
|
||||
static NameLoc get(Identifier name, Location child, MLIRContext *context);
|
||||
static Location get(Identifier name, Location child, MLIRContext *context);
|
||||
|
||||
/// Return a uniqued name location object with an unknown child.
|
||||
static NameLoc get(Identifier name, MLIRContext *context);
|
||||
static Location get(Identifier name, MLIRContext *context);
|
||||
|
||||
/// Return the name identifier.
|
||||
Identifier getName() const;
|
||||
|
@ -216,7 +215,7 @@ public:
|
|||
using Base::Base;
|
||||
|
||||
/// Get an instance of the UnknownLoc.
|
||||
static UnknownLoc get(MLIRContext *context);
|
||||
static Location get(MLIRContext *context);
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast.
|
||||
static bool kindof(unsigned kind) {
|
||||
|
|
|
@ -38,10 +38,10 @@ Module *Builder::createModule() { return new Module(context); }
|
|||
// Locations.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
UnknownLoc Builder::getUnknownLoc() { return UnknownLoc::get(context); }
|
||||
Location Builder::getUnknownLoc() { return UnknownLoc::get(context); }
|
||||
|
||||
FileLineColLoc Builder::getFileLineColLoc(Identifier filename, unsigned line,
|
||||
unsigned column) {
|
||||
Location Builder::getFileLineColLoc(Identifier filename, unsigned line,
|
||||
unsigned column) {
|
||||
return FileLineColLoc::get(filename, line, column, context);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,14 +26,14 @@ using namespace mlir::detail;
|
|||
// CallSiteLoc
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
CallSiteLoc CallSiteLoc::get(Location callee, Location caller,
|
||||
MLIRContext *context) {
|
||||
Location CallSiteLoc::get(Location callee, Location caller,
|
||||
MLIRContext *context) {
|
||||
return Base::get(context, StandardAttributes::CallSiteLocation, callee,
|
||||
caller);
|
||||
}
|
||||
|
||||
CallSiteLoc CallSiteLoc::get(Location name, ArrayRef<Location> frames,
|
||||
MLIRContext *context) {
|
||||
Location CallSiteLoc::get(Location name, ArrayRef<Location> frames,
|
||||
MLIRContext *context) {
|
||||
assert(!frames.empty() && "required at least 1 frames");
|
||||
Location caller = frames.back();
|
||||
for (auto frame : llvm::reverse(frames.drop_back()))
|
||||
|
@ -49,14 +49,14 @@ Location CallSiteLoc::getCaller() const { return getImpl()->caller; }
|
|||
// FileLineColLoc
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
FileLineColLoc FileLineColLoc::get(Identifier filename, unsigned line,
|
||||
unsigned column, MLIRContext *context) {
|
||||
Location FileLineColLoc::get(Identifier filename, unsigned line,
|
||||
unsigned column, MLIRContext *context) {
|
||||
return Base::get(context, StandardAttributes::FileLineColLocation, filename,
|
||||
line, column);
|
||||
}
|
||||
|
||||
FileLineColLoc FileLineColLoc::get(StringRef filename, unsigned line,
|
||||
unsigned column, MLIRContext *context) {
|
||||
Location FileLineColLoc::get(StringRef filename, unsigned line, unsigned column,
|
||||
MLIRContext *context) {
|
||||
return get(Identifier::get(filename.empty() ? "-" : filename, context), line,
|
||||
column, context);
|
||||
}
|
||||
|
@ -69,8 +69,8 @@ unsigned FileLineColLoc::getColumn() const { return getImpl()->column; }
|
|||
// FusedLoc
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
LocationAttr FusedLoc::get(ArrayRef<Location> locs, Attribute metadata,
|
||||
MLIRContext *context) {
|
||||
Location FusedLoc::get(ArrayRef<Location> locs, Attribute metadata,
|
||||
MLIRContext *context) {
|
||||
// Unique the set of locations to be fused.
|
||||
llvm::SmallSetVector<Location, 4> decomposedLocs;
|
||||
for (auto loc : locs) {
|
||||
|
@ -109,13 +109,13 @@ Attribute FusedLoc::getMetadata() const { return getImpl()->metadata; }
|
|||
// NameLoc
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
NameLoc NameLoc::get(Identifier name, Location child, MLIRContext *context) {
|
||||
Location NameLoc::get(Identifier name, Location child, MLIRContext *context) {
|
||||
assert(!child.isa<NameLoc>() &&
|
||||
"a NameLoc cannot be used as a child of another NameLoc");
|
||||
return Base::get(context, StandardAttributes::NameLocation, name, child);
|
||||
}
|
||||
|
||||
NameLoc NameLoc::get(Identifier name, MLIRContext *context) {
|
||||
Location NameLoc::get(Identifier name, MLIRContext *context) {
|
||||
return get(name, UnknownLoc::get(context), context);
|
||||
}
|
||||
|
||||
|
|
|
@ -592,7 +592,7 @@ UnitAttr UnitAttr::get(MLIRContext *context) {
|
|||
return context->getImpl().unitAttr;
|
||||
}
|
||||
|
||||
UnknownLoc UnknownLoc::get(MLIRContext *context) {
|
||||
Location UnknownLoc::get(MLIRContext *context) {
|
||||
return context->getImpl().unknownLocAttr;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ private:
|
|||
MLIRContext *context;
|
||||
|
||||
// TODO(antiagainst): create Location subclass for binary blob
|
||||
UnknownLoc unknownLoc;
|
||||
Location unknownLoc;
|
||||
|
||||
/// The SPIR-V ModuleOp.
|
||||
Optional<spirv::ModuleOp> module;
|
||||
|
|
|
@ -89,7 +89,7 @@ struct ArgConverter {
|
|||
|
||||
/// An instance of the unknown location that is used when generating
|
||||
/// producers.
|
||||
UnknownLoc loc;
|
||||
Location loc;
|
||||
};
|
||||
|
||||
constexpr StringLiteral ArgConverter::kCastName;
|
||||
|
|
|
@ -30,7 +30,7 @@ struct StripDebugInfo : public FunctionPass<StripDebugInfo> {
|
|||
|
||||
void StripDebugInfo::runOnFunction() {
|
||||
Function &func = getFunction();
|
||||
UnknownLoc unknownLoc = UnknownLoc::get(&getContext());
|
||||
auto unknownLoc = UnknownLoc::get(&getContext());
|
||||
|
||||
// Strip the debug info from the function and its operations.
|
||||
func.setLoc(unknownLoc);
|
||||
|
|
Loading…
Reference in New Issue