[llvm] [SandboxIR][NFC] Factor out common test for CastInst subclasses (PR #101410)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 15:12:45 PDT 2024


================
@@ -34,6 +34,8 @@ struct SandboxIRTest : public testing::Test {
         return &BB;
     llvm_unreachable("Expected to find basic block!");
   }
+  template <typename SubclassT, sandboxir::Instruction::Opcode OpcodeT>
+  void testCastInst(const char *IRToParse, Type *SrcTy, Type *DstTy);
----------------
aeubanks wrote:

usually templated definitions are inline rather than defined elsewhere from the declaration due to easily running into cases where you accidentally don't instantiate the definition

I kinda like making this a top level static template function and shuffling around some parameters (e.g. separating the `parseIR` and `testCastInst`, passing `M` to `testCastInst`), but up to you

https://github.com/llvm/llvm-project/pull/101410


More information about the llvm-commits mailing list