summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/cmake/modules/HandleLLVMOptions.cmake6
-rw-r--r--llvm/docs/CodingStandards.rst2
-rw-r--r--llvm/include/llvm/ADT/ArrayRef.h2
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp2
4 files changed, 7 insertions, 5 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 1aadd61c602..7a6f63319fb 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -247,6 +247,12 @@ if( MSVC_IDE )
endif()
if( MSVC )
+ if( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0 )
+ # For MSVC 2013, disable iterator null pointer checking in debug mode,
+ # especially so std::equal(nullptr, nullptr, nullptr) will not assert.
+ add_llvm_definitions("-D_DEBUG_POINTER_IMPL=")
+ endif()
+
include(ChooseMSVCCRT)
if( NOT (${CMAKE_VERSION} VERSION_LESS 2.8.11) )
diff --git a/llvm/docs/CodingStandards.rst b/llvm/docs/CodingStandards.rst
index f410293e1bf..91faadffea6 100644
--- a/llvm/docs/CodingStandards.rst
+++ b/llvm/docs/CodingStandards.rst
@@ -178,8 +178,6 @@ being aware of:
* While most of the atomics library is well implemented, the fences are
missing. Fortunately, they are rarely needed.
* The locale support is incomplete.
-* ``std::equal()`` (and other algorithms) incorrectly assert in MSVC when given
- ``nullptr`` as an iterator.
Other than these areas you should assume the standard library is available and
working as expected until some build bot tells you otherwise. If you're in an
diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h
index e8063305591..c28fdffae73 100644
--- a/llvm/include/llvm/ADT/ArrayRef.h
+++ b/llvm/include/llvm/ADT/ArrayRef.h
@@ -156,8 +156,6 @@ namespace llvm {
bool equals(ArrayRef RHS) const {
if (Length != RHS.Length)
return false;
- if (Length == 0)
- return true;
return std::equal(begin(), end(), RHS.begin());
}
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 0ae52b2caf0..0d73bc5e65d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -5676,7 +5676,7 @@ UpdateNodeOperands(SDNode *N, ArrayRef<SDValue> Ops) {
"Update with wrong number of operands");
// If no operands changed just return the input node.
- if (Ops.empty() || std::equal(Ops.begin(), Ops.end(), N->op_begin()))
+ if (std::equal(Ops.begin(), Ops.end(), N->op_begin()))
return N;
// See if the modified node already exists.
OpenPOWER on IntegriCloud