Fix GCC 5 MLIR Build (NFC)
authorMehdi Amini <joker.eph@gmail.com>
Wed, 19 Jan 2022 06:43:57 +0000 (06:43 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Wed, 19 Jan 2022 06:44:28 +0000 (06:44 +0000)
Try to fix the error:

mlir/lib/Parser/Parser.cpp:553:14: error: cannot call member function 'mlir::InFlightDiagnostic mlir::detail::Parser::emitError(llvm::SMLoc, const llvm::Twine&)' without object
              << "operation location alias was never defined";

mlir/lib/Parser/Parser.cpp

index c97aad4..0a5e79c 100644 (file)
@@ -547,18 +547,18 @@ ParseResult OperationParser::finalize() {
   // Resolve the locations of any deferred operations.
   auto &attributeAliases = state.symbols.attributeAliasDefinitions;
   auto locID = TypeID::get<DeferredLocInfo *>();
-  auto resolveLocation = [&](auto &opOrArgument) -> LogicalResult {
+  auto resolveLocation = [&, this](auto &opOrArgument) -> LogicalResult {
     auto fwdLoc = opOrArgument.getLoc().template dyn_cast<OpaqueLoc>();
     if (!fwdLoc || fwdLoc.getUnderlyingTypeID() != locID)
       return success();
     auto locInfo = deferredLocsReferences[fwdLoc.getUnderlyingLocation()];
     Attribute attr = attributeAliases.lookup(locInfo.identifier);
     if (!attr)
-      return emitError(locInfo.loc)
+      return this->emitError(locInfo.loc)
              << "operation location alias was never defined";
     auto locAttr = attr.dyn_cast<LocationAttr>();
     if (!locAttr)
-      return emitError(locInfo.loc)
+      return this->emitError(locInfo.loc)
              << "expected location, but found '" << attr << "'";
     opOrArgument.setLoc(locAttr);
     return success();