From e328296b61962d65ddf45201a5cf2d6fa12824fc Mon Sep 17 00:00:00 2001 From: Thomas Symalla Date: Sun, 5 Nov 2023 09:32:59 +0100 Subject: [PATCH] Fix MSVC build. The recent changes to OpDescription to handle different LLVM versions cause a UB warning on MSVC: C5101: use of preprocessor directive in function-like macro argument list is undefined behavior --- lib/Dialect/OpDescription.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/Dialect/OpDescription.cpp b/lib/Dialect/OpDescription.cpp index a6c5f18..d01a682 100644 --- a/lib/Dialect/OpDescription.cpp +++ b/lib/Dialect/OpDescription.cpp @@ -152,20 +152,23 @@ HANDLE_INTRINSIC_DESC_OPCODE_SET(LifetimeIntrinsic, Intrinsic::lifetime_start, #endif // Add Intrinsic::dbg_addr back for sufficiently recent LLVM -HANDLE_INTRINSIC_DESC_OPCODE_SET(DbgInfoIntrinsic, Intrinsic::dbg_declare, - Intrinsic::dbg_value, Intrinsic::dbg_label #if HAVE_LLVM_VERSION_MAJOR >= 16 - ,Intrinsic::dbg_assign +HANDLE_INTRINSIC_DESC_OPCODE_SET(DbgInfoIntrinsic, Intrinsic::dbg_declare, + Intrinsic::dbg_value, Intrinsic::dbg_label, + Intrinsic::dbg_assign) +#else +HANDLE_INTRINSIC_DESC_OPCODE_SET(DbgInfoIntrinsic, Intrinsic::dbg_declare, + Intrinsic::dbg_value, Intrinsic::dbg_label) #endif - ) // Add Intrinsic::dbg_addr back for sufficiently recent LLVM -HANDLE_INTRINSIC_DESC_OPCODE_SET(DbgVariableIntrinsic, Intrinsic::dbg_declare, - Intrinsic::dbg_value #if HAVE_LLVM_VERSION_MAJOR >= 16 - ,Intrinsic::dbg_assign +HANDLE_INTRINSIC_DESC_OPCODE_SET(DbgVariableIntrinsic, Intrinsic::dbg_declare, + Intrinsic::dbg_value, Intrinsic::dbg_assign) +#else +HANDLE_INTRINSIC_DESC_OPCODE_SET(DbgVariableIntrinsic, Intrinsic::dbg_declare, + Intrinsic::dbg_value) #endif - ) HANDLE_INTRINSIC_DESC(DbgDeclareInst, dbg_declare) HANDLE_INTRINSIC_DESC(DbgValueInst, dbg_value)