[llvm] da76073 - [RemoveDIs][DebugInfo] Explicitly convert iterator to pointer for std::distance
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 16 06:35:07 PST 2024
Author: Stephen Tozer
Date: 2024-01-16T14:34:35Z
New Revision: da7607307a5eed532d1ad9d2cd020e67b299b129
URL: https://github.com/llvm/llvm-project/commit/da7607307a5eed532d1ad9d2cd020e67b299b129
DIFF: https://github.com/llvm/llvm-project/commit/da7607307a5eed532d1ad9d2cd020e67b299b129.diff
LOG: [RemoveDIs][DebugInfo] Explicitly convert iterator to pointer for std::distance
This is a small patch attempting to fix an error with a prior patch which
caused buildbot failures on certain targets; for example:
https://lab.llvm.org/buildbot/#/builders/127/builds/60931
The compile error comes from std::distance not having an overload for a
std::array iterator and a raw pointer; this patch converts the iterator
to a pointer to resolve this.
Fixes d499df02
Added:
Modified:
llvm/lib/IR/Metadata.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index da5d4940a6ab9b..c8f01da30b99ae 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -157,7 +157,7 @@ void DebugValueUser::handleChangedValue(void *Old, Metadata *New) {
// NOTE: We could inform the "owner" that a value has changed through
// getOwner, if needed.
auto OldMD = static_cast<Metadata **>(Old);
- ptr
diff _t Idx = std::distance(DebugValues.begin(), OldMD);
+ ptr
diff _t Idx = std::distance(&*DebugValues.begin(), OldMD);
resetDebugValue(Idx, New);
}
More information about the llvm-commits
mailing list