using Base::Base;
/// Return a uniqued call location object.
- static Location get(Location callee, Location caller, MLIRContext *context);
+ static Location get(Location callee, Location caller);
/// 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 Location get(Location name, ArrayRef<Location> frames,
- MLIRContext *context);
+ static Location get(Location name, ArrayRef<Location> frames);
/// The concrete location information this object presents.
Location getCallee() const;
/// Return a uniqued name location object. The child location must not be
/// another NameLoc.
- static Location get(Identifier name, Location child, MLIRContext *context);
+ static Location get(Identifier name, Location child);
/// Return a uniqued name location object with an unknown child.
static Location get(Identifier name, MLIRContext *context);
// CallSiteLoc
//===----------------------------------------------------------------------===//
-Location CallSiteLoc::get(Location callee, Location caller,
- MLIRContext *context) {
- return Base::get(context, StandardAttributes::CallSiteLocation, callee,
- caller);
+Location CallSiteLoc::get(Location callee, Location caller) {
+ return Base::get(callee->getContext(), StandardAttributes::CallSiteLocation,
+ callee, caller);
}
-Location CallSiteLoc::get(Location name, ArrayRef<Location> frames,
- MLIRContext *context) {
- assert(!frames.empty() && "required at least 1 frames");
+Location CallSiteLoc::get(Location name, ArrayRef<Location> frames) {
+ assert(!frames.empty() && "required at least 1 call frame");
Location caller = frames.back();
for (auto frame : llvm::reverse(frames.drop_back()))
- caller = CallSiteLoc::get(frame, caller, context);
- return CallSiteLoc::get(name, caller, context);
+ caller = CallSiteLoc::get(frame, caller);
+ return CallSiteLoc::get(name, caller);
}
Location CallSiteLoc::getCallee() const { return getImpl()->callee; }
// NameLoc
//===----------------------------------------------------------------------===//
-Location NameLoc::get(Identifier name, Location child, MLIRContext *context) {
+Location NameLoc::get(Identifier name, Location child) {
assert(!child.isa<NameLoc>() &&
"a NameLoc cannot be used as a child of another NameLoc");
- return Base::get(context, StandardAttributes::NameLocation, name, child);
+ return Base::get(child->getContext(), StandardAttributes::NameLocation, name,
+ child);
}
Location NameLoc::get(Identifier name, MLIRContext *context) {
- return get(name, UnknownLoc::get(context), context);
+ return get(name, UnknownLoc::get(context));
}
/// Return the name identifier.
/// unknown-location ::= 'unknown'
///
ParseResult Parser::parseCallSiteLocation(LocationAttr &loc) {
- auto *ctx = getContext();
-
consumeToken(Token::bare_identifier);
// Parse the '('.
return failure();
// Return the callsite location.
- loc = CallSiteLoc::get(calleeLoc, callerLoc, ctx);
+ loc = CallSiteLoc::get(calleeLoc, callerLoc);
return success();
}
if (childLoc.isa<NameLoc>())
return emitError(childSourceLoc,
"child of NameLoc cannot be another NameLoc");
- loc = NameLoc::get(Identifier::get(str, ctx), childLoc, ctx);
+ loc = NameLoc::get(Identifier::get(str, ctx), childLoc);
// Parse the closing ')'.
if (parseToken(Token::r_paren,