Skip to content

Commit d55a077

Browse files
Abhinkopakiramenai
authored andcommitted
Change type of DiagnosticHandlerTy (#86504)
Changing type of DiagnosticHandlerTy due to adding -Wcast-function-type-mismatch to -Wextra group(llvm/llvm-project#86131 (comment)). Changed the reference argument DiagnosticInfo to a pointer and edited the test cases failing due to this change. Added another small change where Gtest api was throwing an warning due varargs argument not being passed.
1 parent 02ad3f6 commit d55a077

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llvm/include/llvm/IR/DiagnosticHandler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct DiagnosticHandler {
2727
: DiagnosticContext(DiagContext) {}
2828
virtual ~DiagnosticHandler() = default;
2929

30-
using DiagnosticHandlerTy = void (*)(const DiagnosticInfo &DI, void *Context);
30+
using DiagnosticHandlerTy = void (*)(const DiagnosticInfo *DI, void *Context);
3131

3232
/// DiagHandlerCallback is settable from the C API and base implementation
3333
/// of DiagnosticHandler will call it from handleDiagnostics(). Any derived
@@ -41,7 +41,7 @@ struct DiagnosticHandler {
4141
/// with a prefix based on the severity.
4242
virtual bool handleDiagnostics(const DiagnosticInfo &DI) {
4343
if (DiagHandlerCallback) {
44-
DiagHandlerCallback(DI, DiagnosticContext);
44+
DiagHandlerCallback(&DI, DiagnosticContext);
4545
return true;
4646
}
4747
return false;

llvm/unittests/Linker/LinkModulesTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class LinkModuleTest : public testing::Test {
7171
BasicBlock *ExitBB;
7272
};
7373

74-
static void expectNoDiags(const DiagnosticInfo &DI, void *C) {
74+
static void expectNoDiags(const DiagnosticInfo *DI, void *C) {
7575
llvm_unreachable("expectNoDiags called!");
7676
}
7777

0 commit comments

Comments
 (0)