Skip to content

Commit

Permalink
Change type of DiagnosticHandlerTy (#86504)
Browse files Browse the repository at this point in the history
Changing type of DiagnosticHandlerTy due to adding
-Wcast-function-type-mismatch to -Wextra
group(#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.
  • Loading branch information
Abhinkop committed Mar 26, 2024
1 parent 2f63718 commit 44d037c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions llvm/include/llvm/IR/DiagnosticHandler.h
Expand Up @@ -28,7 +28,7 @@ struct DiagnosticHandler {
: DiagnosticContext(DiagContext) {}
virtual ~DiagnosticHandler() = default;

using DiagnosticHandlerTy = void (*)(const DiagnosticInfo &DI, void *Context);
using DiagnosticHandlerTy = void (*)(const DiagnosticInfo *DI, void *Context);

/// DiagHandlerCallback is settable from the C API and base implementation
/// of DiagnosticHandler will call it from handleDiagnostics(). Any derived
Expand All @@ -42,7 +42,7 @@ struct DiagnosticHandler {
/// with a prefix based on the severity.
virtual bool handleDiagnostics(const DiagnosticInfo &DI) {
if (DiagHandlerCallback) {
DiagHandlerCallback(DI, DiagnosticContext);
DiagHandlerCallback(&DI, DiagnosticContext);
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion llvm/unittests/Linker/LinkModulesTest.cpp
Expand Up @@ -72,7 +72,7 @@ class LinkModuleTest : public testing::Test {
BasicBlock *ExitBB;
};

static void expectNoDiags(const DiagnosticInfo &DI, void *C) {
static void expectNoDiags(const DiagnosticInfo *DI, void *C) {
llvm_unreachable("expectNoDiags called!");
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/unittests/Support/ThreadPool.cpp
Expand Up @@ -126,7 +126,7 @@ using ThreadPoolImpls = ::testing::Types<
#endif
SingleThreadExecutor>;

TYPED_TEST_SUITE(ThreadPoolTest, ThreadPoolImpls);
TYPED_TEST_SUITE(ThreadPoolTest, ThreadPoolImpls, );

#define CHECK_UNSUPPORTED() \
do { \
Expand Down

0 comments on commit 44d037c

Please sign in to comment.