diff --git a/mlir/lib/AsmParser/Parser.cpp b/mlir/lib/AsmParser/Parser.cpp index 2e4c4a36d46b9b8..83eec3244009d87 100644 --- a/mlir/lib/AsmParser/Parser.cpp +++ b/mlir/lib/AsmParser/Parser.cpp @@ -2412,14 +2412,15 @@ ParseResult OperationParser::parseOptionalBlockArgList(Block *owner) { //===----------------------------------------------------------------------===// ParseResult OperationParser::codeCompleteSSAUse() { - std::string detailData; - llvm::raw_string_ostream detailOS(detailData); for (IsolatedSSANameScope &scope : isolatedNameScopes) { for (auto &it : scope.values) { if (it.second.empty()) continue; Value frontValue = it.second.front().value; + std::string detailData; + llvm::raw_string_ostream detailOS(detailData); + // If the value isn't a forward reference, we also add the name of the op // to the detail. if (auto result = dyn_cast(frontValue)) { @@ -2440,7 +2441,7 @@ ParseResult OperationParser::codeCompleteSSAUse() { detailOS << ", ..."; state.codeCompleteContext->appendSSAValueCompletion( - it.getKey(), std::move(detailOS.str())); + it.getKey(), std::move(detailData)); } }