[libcxx][NFC] Address -Wmicrosoft-cast in MSVC's exception_ptr - #210570
Merged
Conversation
This was introduced as part of llvm#94977.
|
@llvm/pr-subscribers-libcxx Author: Petr Hosek (petrhosek) ChangesThis was introduced as part of #94977. Full diff: https://github.com/llvm/llvm-project/pull/210570.diff 1 Files Affected:
diff --git a/libcxx/src/support/runtime/exception_pointer_msvc.ipp b/libcxx/src/support/runtime/exception_pointer_msvc.ipp
index 3102d1ee93db2..4b877deeec7bc 100644
--- a/libcxx/src/support/runtime/exception_pointer_msvc.ipp
+++ b/libcxx/src/support/runtime/exception_pointer_msvc.ipp
@@ -141,7 +141,7 @@ void __copy_exception_object(void* __dest, const void* __src, const CatchableTyp
#if _EH_RELATIVE_TYPEINFO
const auto __copy_func = reinterpret_cast<void*>(__throw_image_base + __type->copyFunction);
#else // _EH_RELATIVE_TYPEINFO
- const auto __copy_func = __type->copyFunction;
+ const auto __copy_func = reinterpret_cast<void*>(__type->copyFunction);
#endif // _EH_RELATIVE_TYPEINFO
const auto __adjusted = __AdjustPointer(const_cast<void*>(__src), __type->thisDisplacement);
@@ -204,7 +204,8 @@ struct alignas(__STDCPP_DEFAULT_NEW_ALIGNMENT__) __exception_ptr_normal final :
__call_member_function_0(__cpp_eh_record.params.pExceptionObject,
reinterpret_cast<void*>(__throw_info->pmfnUnwind + __throw_image_base));
#else // _EH_RELATIVE_TYPEINFO
- __call_member_function_0(__cpp_eh_record.params.pExceptionObject, __throw_info->pmfnUnwind);
+ __call_member_function_0(__cpp_eh_record.params.pExceptionObject,
+ reinterpret_cast<void*>(__throw_info->pmfnUnwind));
#endif // _EH_RELATIVE_TYPEINFO
} else if (__type->properties & CT_IsWinRTHandle) {
const auto* __unknown = *static_cast<IUnknown* const*>(__cpp_eh_record.params.pExceptionObject);
|
Contributor
|
Most LGTM. The PR title looks a bit ambiguous to me. Perhaps it's better to clarify that we're using |
Member
Author
Done. |
frederick-vs-ja
approved these changes
Jul 19, 2026
Member
Author
|
/cherry-pick 16ffd27 |
1 similar comment
Contributor
|
/cherry-pick 16ffd27 |
Member
|
/pull-request #210765 |
dyung
pushed a commit
to llvmbot/llvm-project
that referenced
this pull request
Jul 22, 2026
…210570) This was introduced as part of llvm#94977. Rather than suppressing the warning with `#pragma clang diagnostic ignored`, we use `reinterpret_cast` to avoid the implicit conversion. (cherry picked from commit 16ffd27)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was introduced as part of #94977. Rather than suppressing the warning with
#pragma clang diagnostic ignored, we usereinterpret_castto avoid the implicit conversion.