Skip to content

Commit 9aea667

Browse files
authored
[symbolizer] Change the ErrorHandler from llvm::function_ref to std::function. (llvm#115477)
This fixes dangling `ErrorHandler` references ([here](https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp#L48-L53) is an example). `llvm::function_ref` doesn't own the callable, and it is not safe to store a function_ref (the `PlainPrinterBase` stores a `llvm::function_ref` which can easily lead to dangling references).
1 parent 1645d99 commit 9aea667

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct PrinterConfig {
6565
int SourceContextLines;
6666
};
6767

68-
using ErrorHandler = function_ref<void(const ErrorInfoBase &, StringRef)>;
68+
using ErrorHandler = std::function<void(const ErrorInfoBase &, StringRef)>;
6969

7070
class PlainPrinterBase : public DIPrinter {
7171
protected:

0 commit comments

Comments
 (0)