[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Analysis / ptr-iter.cpp
bloba94288cd1c8cccb96ed0513565d503ea4da1321a
1 // RUN: %clang_analyze_cc1 %s -std=c++14 -analyzer-output=text -verify \
2 // RUN: -analyzer-checker=core,alpha.nondeterminism.PointerIteration
4 #include "Inputs/system-header-simulator-cxx.h"
6 template<class T>
7 void f(T x);
9 void PointerIteration() {
10 int a = 1, b = 2;
11 std::set<int> OrderedIntSet = {a, b};
12 std::set<int *> OrderedPtrSet = {&a, &b};
13 std::unordered_set<int> UnorderedIntSet = {a, b};
14 std::unordered_set<int *> UnorderedPtrSet = {&a, &b};
16 for (auto i : OrderedIntSet) // no-warning
17 f(i);
19 for (auto i : OrderedPtrSet) // no-warning
20 f(i);
22 for (auto i : UnorderedIntSet) // no-warning
23 f(i);
25 for (auto i : UnorderedPtrSet) // expected-warning {{Iteration of pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerIteration]
26 // expected-note@-1 {{Iteration of pointer-like elements can result in non-deterministic ordering}} [alpha.nondeterminism.PointerIteration]
27 f(i);