Skip to content

Commit

Permalink
Fix MSVC build.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Thomas Symalla committed Nov 5, 2023
1 parent f00b575 commit e328296
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions lib/Dialect/OpDescription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e328296

Please sign in to comment.