Remove const reference to errorReporter.
Fixes use-after-free ASAN failure.
PiperOrigin-RevId: 204177796
diff --git a/lib/Parser/Lexer.cpp b/lib/Parser/Lexer.cpp
index 8e94560..ffc12c8 100644
--- a/lib/Parser/Lexer.cpp
+++ b/lib/Parser/Lexer.cpp
@@ -31,8 +31,7 @@
return c == '$' || c == '.' || c == '_' || c == '-';
}
-Lexer::Lexer(llvm::SourceMgr &sourceMgr,
- const SMDiagnosticHandlerTy &errorReporter)
+Lexer::Lexer(llvm::SourceMgr &sourceMgr, SMDiagnosticHandlerTy errorReporter)
: sourceMgr(sourceMgr), errorReporter(errorReporter) {
auto bufferID = sourceMgr.getMainFileID();
curBuffer = sourceMgr.getMemoryBuffer(bufferID)->getBuffer();