Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
Use cast on getInterface for FileCheck. (#66)
Browse files Browse the repository at this point in the history
* Use cast on getInterface for FileCheck.

* Small formatting fixes.
  • Loading branch information
jsmall-zzz authored Apr 11, 2023
1 parent cc73b89 commit 3a97b38
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions source/slang-llvm/slang-llvm-filecheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class LLVMFileCheck : IFileCheck, ComBaseObject
TestMessageType testMessageType;
};

static void fileCheckDiagHandler(const SMDiagnostic & diag, void *reporterData);
static void fileCheckDiagHandler(const SMDiagnostic& diag, void* reporterData);
};

class DisplayedStringOStream : public raw_string_ostream
Expand All @@ -61,15 +61,14 @@ class DisplayedStringOStream : public raw_string_ostream
virtual bool is_displayed() const override { return true; };
};

void LLVMFileCheck::fileCheckDiagHandler(const SMDiagnostic & diag, void *dataPtr)
void LLVMFileCheck::fileCheckDiagHandler(const SMDiagnostic& diag, void* dataPtr)
{
const ReporterData& reporterData = *reinterpret_cast<ReporterData*>(dataPtr);
std::string s;
DisplayedStringOStream o(s);
o.enable_colors(reporterData.colorDiagnosticOutput);
diag.print(reporterData.programName, o);
reporterData.reportFun(reporterData.data, TestMessageType::TestFailure, s.c_str());

}

TestResult LLVMFileCheck::performTest(
Expand Down Expand Up @@ -161,7 +160,7 @@ void* LLVMFileCheck::getInterface(const Guid& guid)
guid == ICastable::getTypeGuid() ||
guid == IFileCheck::getTypeGuid())
{
return this;
return static_cast<IFileCheck*>(this);
}
return nullptr;
}
Expand Down

0 comments on commit 3a97b38

Please sign in to comment.