@@ -273,10 +273,54 @@ mlirLocationFileLineColRangeGet(MlirContext context, MlirStringRef filename,
273273 startLine, startCol, endLine, endCol)));
274274}
275275
276+ MlirIdentifier mlirLocationFileLineColRangeGetFilename (MlirLocation location) {
277+ return wrap ((llvm::cast<FileLineColRange>(unwrap (location)).getFilename ()));
278+ }
279+
280+ unsigned mlirLocationFileLineColRangeGetStartLine (MlirLocation location) {
281+ return llvm::cast<FileLineColRange>(unwrap (location)).getStartLine ();
282+ }
283+
284+ unsigned mlirLocationFileLineColRangeGetStartColumn (MlirLocation location) {
285+ return llvm::cast<FileLineColRange>(unwrap (location)).getStartColumn ();
286+ }
287+
288+ unsigned mlirLocationFileLineColRangeGetEndLine (MlirLocation location) {
289+ return llvm::cast<FileLineColRange>(unwrap (location)).getEndLine ();
290+ }
291+
292+ unsigned mlirLocationFileLineColRangeGetEndColumn (MlirLocation location) {
293+ return llvm::cast<FileLineColRange>(unwrap (location)).getEndColumn ();
294+ }
295+
296+ MlirTypeID mlirLocationFileLineColRangeGetTypeID () {
297+ return wrap (FileLineColRange::getTypeID ());
298+ }
299+
300+ bool mlirLocationisAFileLineColRange (MlirLocation location) {
301+ return isa<FileLineColRange>(unwrap (location));
302+ }
303+
276304MlirLocation mlirLocationCallSiteGet (MlirLocation callee, MlirLocation caller) {
277305 return wrap (Location (CallSiteLoc::get (unwrap (callee), unwrap (caller))));
278306}
279307
308+ MlirLocation mlirLocationCallSiteGetCallee (MlirLocation location) {
309+ return wrap (Location (llvm::cast<CallSiteLoc>(unwrap (location)).getCallee ()));
310+ }
311+
312+ MlirLocation mlirLocationCallSiteGetCaller (MlirLocation location) {
313+ return wrap (Location (llvm::cast<CallSiteLoc>(unwrap (location)).getCaller ()));
314+ }
315+
316+ MlirTypeID mlirLocationCallSiteGetTypeID () {
317+ return wrap (CallSiteLoc::getTypeID ());
318+ }
319+
320+ bool mlirLocationisACallSite (MlirLocation location) {
321+ return isa<CallSiteLoc>(unwrap (location));
322+ }
323+
280324MlirLocation mlirLocationFusedGet (MlirContext ctx, intptr_t nLocations,
281325 MlirLocation const *locations,
282326 MlirAttribute metadata) {
@@ -285,6 +329,30 @@ MlirLocation mlirLocationFusedGet(MlirContext ctx, intptr_t nLocations,
285329 return wrap (FusedLoc::get (unwrappedLocs, unwrap (metadata), unwrap (ctx)));
286330}
287331
332+ void mlirLocationFusedGetLocations (MlirLocation location,
333+ MlirLocation **locationsCPtr,
334+ unsigned *nLocations) {
335+ llvm::ArrayRef<Location> locationsArrRef =
336+ llvm::cast<FusedLoc>(unwrap (location)).getLocations ();
337+ assert (!locationsArrRef.empty () && " expected non-empty locations" );
338+ SmallVector<MlirLocation> *locationsVec =
339+ new SmallVector<MlirLocation>(locationsArrRef.size ());
340+ for (auto [i, location] : llvm::enumerate (locationsArrRef))
341+ locationsVec->operator [](i) = wrap (location);
342+ *nLocations = locationsVec->size ();
343+ *locationsCPtr = locationsVec->data ();
344+ }
345+
346+ MlirAttribute mlirLocationFusedGetMetadata (MlirLocation location) {
347+ return wrap (llvm::cast<FusedLoc>(unwrap (location)).getMetadata ());
348+ }
349+
350+ MlirTypeID mlirLocationFusedGetTypeID () { return wrap (FusedLoc::getTypeID ()); }
351+
352+ bool mlirLocationisAFused (MlirLocation location) {
353+ return isa<FusedLoc>(unwrap (location));
354+ }
355+
288356MlirLocation mlirLocationNameGet (MlirContext context, MlirStringRef name,
289357 MlirLocation childLoc) {
290358 if (mlirLocationIsNull (childLoc))
@@ -294,6 +362,20 @@ MlirLocation mlirLocationNameGet(MlirContext context, MlirStringRef name,
294362 StringAttr::get (unwrap (context), unwrap (name)), unwrap (childLoc))));
295363}
296364
365+ MlirIdentifier mlirLocationNameGetName (MlirLocation location) {
366+ return wrap ((llvm::cast<NameLoc>(unwrap (location)).getName ()));
367+ }
368+
369+ MlirLocation mlirLocationNameGetChildLoc (MlirLocation location) {
370+ return wrap (Location (llvm::cast<NameLoc>(unwrap (location)).getChildLoc ()));
371+ }
372+
373+ MlirTypeID mlirLocationNameGetTypeID () { return wrap (NameLoc::getTypeID ()); }
374+
375+ bool mlirLocationisAName (MlirLocation location) {
376+ return isa<NameLoc>(unwrap (location));
377+ }
378+
297379MlirLocation mlirLocationUnknownGet (MlirContext context) {
298380 return wrap (Location (UnknownLoc::get (unwrap (context))));
299381}
0 commit comments