[clang] fd02a86 - [analyzer] Add system header simulator a symmetric random access iterator operator+
Endre Fülöp via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 17 05:39:20 PDT 2020
Author: Endre Fülöp
Date: 2020-07-17T14:36:43+02:00
New Revision: fd02a86260b3fb01361175af9600d53354631fb2
URL: https://github.com/llvm/llvm-project/commit/fd02a86260b3fb01361175af9600d53354631fb2
DIFF: https://github.com/llvm/llvm-project/commit/fd02a86260b3fb01361175af9600d53354631fb2.diff
LOG: [analyzer] Add system header simulator a symmetric random access iterator operator+
Summary:
Random access iterators must handle operator+, where the iterator is on the
RHS. The system header simulator library is extended with these operators.
Reviewers: Szelethus
Subscribers: whisperity, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, steakhal, martong, ASDenysPetrov, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83226
Added:
Modified:
clang/test/Analysis/Inputs/system-header-simulator-cxx.h
clang/test/Analysis/diagnostics/explicit-suppression.cpp
Removed:
################################################################################
diff --git a/clang/test/Analysis/Inputs/system-header-simulator-cxx.h b/clang/test/Analysis/Inputs/system-header-simulator-cxx.h
index fe4b9d081e9c..1dee3294d732 100644
--- a/clang/test/Analysis/Inputs/system-header-simulator-cxx.h
+++ b/clang/test/Analysis/Inputs/system-header-simulator-cxx.h
@@ -60,6 +60,11 @@ template <typename T, typename Ptr, typename Ref> struct __vector_iterator {
__vector_iterator<T, Ptr, Ref> operator+(
diff erence_type n) {
return ptr + n;
}
+ friend __vector_iterator<T, Ptr, Ref> operator+(
+
diff erence_type n,
+ const __vector_iterator<T, Ptr, Ref> &iter) {
+ return n + iter.ptr;
+ }
__vector_iterator<T, Ptr, Ref> operator-(
diff erence_type n) {
return ptr - n;
}
@@ -118,6 +123,11 @@ template <typename T, typename Ptr, typename Ref> struct __deque_iterator {
__deque_iterator<T, Ptr, Ref> operator+(
diff erence_type n) {
return ptr + n;
}
+ friend __deque_iterator<T, Ptr, Ref> operator+(
+
diff erence_type n,
+ const __deque_iterator<T, Ptr, Ref> &iter) {
+ return n + iter.ptr;
+ }
__deque_iterator<T, Ptr, Ref> operator-(
diff erence_type n) {
return ptr - n;
}
diff --git a/clang/test/Analysis/diagnostics/explicit-suppression.cpp b/clang/test/Analysis/diagnostics/explicit-suppression.cpp
index 2b586add19ee..0ef01771e58b 100644
--- a/clang/test/Analysis/diagnostics/explicit-suppression.cpp
+++ b/clang/test/Analysis/diagnostics/explicit-suppression.cpp
@@ -19,6 +19,6 @@ class C {
void testCopyNull(C *I, C *E) {
std::copy(I, E, (C *)0);
#ifndef SUPPRESSED
- // expected-warning at ../Inputs/system-header-simulator-cxx.h:699 {{Called C++ object pointer is null}}
+ // expected-warning at ../Inputs/system-header-simulator-cxx.h:709 {{Called C++ object pointer is null}}
#endif
}
More information about the cfe-commits
mailing list