aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-03-14 15:23:40 +0000
committerPavel Labath <pavel@labath.sk>2019-03-14 15:23:40 +0000
commit4b1a5099240d25d3a59ea4834e20bc7b56b62032 (patch)
tree23b74bbecf7015b4f2d670b6307129fb3b418af2 /llvm/lib/CodeGen/MachineInstr.cpp
parent6bc3a7703b31a4811124e263a47b91e8b5b8958a (diff)
downloadllvm-4b1a5099240d25d3a59ea4834e20bc7b56b62032.zip
llvm-4b1a5099240d25d3a59ea4834e20bc7b56b62032.tar.gz
llvm-4b1a5099240d25d3a59ea4834e20bc7b56b62032.tar.bz2
YAMLIO: Improve template arg deduction for mapOptional
Summary: The way c++ template argument deduction works, both arguments are used to deduce the template type in the three-argument overload of mapOptional. This is a problem if the types are slightly different, even if they are implicitly convertible. This is fairly easy to trigger with integral types, as the default type of most integral constants is int, which then requires casting the constant to the type of the other argument. This patch fixes that by using a separate template type for the default value, which is then cast to the type of the first argument. To avoid this conversion triggerring conversions marged as explicit, we use static_assert to check that the types are implicitly convertible. Reviewers: zturner, sammccall Subscribers: kristina, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59142 llvm-svn: 356157
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
0 files changed, 0 insertions, 0 deletions