[llvm-branch-commits] [llvm-branch] r245233 - Fix the issue addressed in r243996: avoid calling std::equals on nullptr
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Aug 17 13:08:48 PDT 2015
Author: hans
Date: Mon Aug 17 15:08:47 2015
New Revision: 245233
URL: http://llvm.org/viewvc/llvm-project?rev=245233&view=rev
Log:
Fix the issue addressed in r243996: avoid calling std::equals on nullptr
because MSVC's STL implementation can trip a debug assert on that.
There is still a discussion ongoing about r243996, so let's just apply
a minimal fix for 3.7.
Modified:
llvm/branches/release_37/lib/IR/Type.cpp
Modified: llvm/branches/release_37/lib/IR/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/lib/IR/Type.cpp?rev=245233&r1=245232&r2=245233&view=diff
==============================================================================
--- llvm/branches/release_37/lib/IR/Type.cpp (original)
+++ llvm/branches/release_37/lib/IR/Type.cpp Mon Aug 17 15:08:47 2015
@@ -613,6 +613,9 @@ bool StructType::isLayoutIdentical(Struc
if (isPacked() != Other->isPacked() ||
getNumElements() != Other->getNumElements())
return false;
+
+ if (!getNumElements())
+ return true;
return std::equal(element_begin(), element_end(), Other->element_begin());
}
More information about the llvm-branch-commits
mailing list