summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-09 21:23:21 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-09 21:23:21 +0000
commitfdc82ccb3f2b23a89e7002fe8238e1422b00f96a (patch)
treef189aa0a3010e0eb212970b8eadf0a8b098985ea /test
parent6694ed095d6b27a2c92ec4fd63664fcd88a05749 (diff)
Notes
Diffstat (limited to 'test')
-rw-r--r--test/Analysis/Inputs/system-header-simulator-cxx.h64
-rw-r--r--test/Analysis/diagnostics/explicit-suppression.cpp2
-rw-r--r--test/Analysis/inlining/stl.cpp3
-rw-r--r--test/Analysis/iterator-past-end.cpp205
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp30
-rw-r--r--test/CXX/drs/dr13xx.cpp130
-rw-r--r--test/CXX/drs/dr19xx.cpp9
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp4
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp13
-rw-r--r--test/CXX/temp/temp.param/p5.cpp10
-rw-r--r--test/CodeGen/lifetime2.c2
-rw-r--r--test/CodeGen/thinlto_backend.ll8
-rw-r--r--test/CodeGenCXX/arm.cpp9
-rw-r--r--test/CodeGenCXX/debug-info-class.cpp15
-rw-r--r--test/CodeGenCXX/dllexport-ctor-closure.cpp82
-rw-r--r--test/CodeGenCXX/dllexport.cpp51
-rw-r--r--test/CodeGenCXX/eh-aggregate-copy-destroy.cpp6
-rw-r--r--test/CodeGenCXX/exceptions.cpp104
-rw-r--r--test/CodeGenCXX/goto.cpp7
-rw-r--r--test/Driver/B-opt.c8
-rw-r--r--test/Driver/coverage-ld.c8
-rw-r--r--test/Driver/cross-linux.c18
-rw-r--r--test/Driver/fuchsia.c2
-rw-r--r--test/Driver/fuchsia.cpp2
-rw-r--r--test/Driver/fuse-ld.c4
-rw-r--r--test/Driver/instrprof-ld.c24
-rw-r--r--test/Driver/mips-mti-linux.c4
-rw-r--r--test/Driver/netbsd.c36
-rw-r--r--test/Driver/netbsd.cpp40
-rw-r--r--test/Driver/nostdlib.c4
-rw-r--r--test/Driver/prefixed-tools.c4
-rw-r--r--test/Driver/sanitizer-ld.c94
-rw-r--r--test/Driver/windows-cross.c14
-rw-r--r--test/Index/Core/index-source.cpp11
-rw-r--r--test/Misc/diag-template-diffing.cpp6
-rw-r--r--test/Modules/Inputs/pch-with-module-name/A.h1
-rw-r--r--test/Modules/Inputs/pch-with-module-name/C.h1
-rw-r--r--test/Modules/Inputs/pch-with-module-name/C.m1
-rw-r--r--test/Modules/Inputs/pch-with-module-name/D.h1
-rw-r--r--test/Modules/Inputs/pch-with-module-name/module.modulemap9
-rw-r--r--test/Modules/Inputs/pch-with-module-name/test.h1
-rw-r--r--test/Modules/pch-with-module-name.m5
-rw-r--r--test/OpenMP/atomic_codegen.cpp11
-rw-r--r--test/OpenMP/threadprivate_codegen.cpp2
-rw-r--r--test/Sema/diagnose_if.c152
-rw-r--r--test/SemaCXX/PR10177.cpp9
-rw-r--r--test/SemaCXX/attr-mode-tmpl.cpp2
-rw-r--r--test/SemaCXX/attr-noreturn.cpp10
-rw-r--r--test/SemaCXX/constant-expression-cxx11.cpp4
-rw-r--r--test/SemaCXX/cxx1z-constexpr-lambdas.cpp114
-rw-r--r--test/SemaCXX/diagnose_if.cpp460
-rw-r--r--test/SemaCXX/enable_if.cpp8
-rw-r--r--test/SemaCXX/implicit-exception-spec.cpp32
-rw-r--r--test/SemaCXX/libstdcxx_gets_hack.cpp28
-rw-r--r--test/SemaCXX/member-init.cpp24
-rw-r--r--test/SemaCXX/overload-call.cpp2
-rw-r--r--test/SemaCXX/overload-member-call.cpp2
-rw-r--r--test/SemaCXX/undefined-internal.cpp11
-rw-r--r--test/SemaTemplate/alias-templates.cpp10
-rw-r--r--test/SemaTemplate/constexpr-instantiate.cpp91
-rw-r--r--test/SemaTemplate/deduction.cpp30
-rw-r--r--test/SemaTemplate/default-arguments-cxx0x.cpp2
-rw-r--r--test/SemaTemplate/instantiate-init.cpp3
-rw-r--r--test/SemaTemplate/temp_arg_nontype.cpp8
64 files changed, 1775 insertions, 292 deletions
diff --git a/test/Analysis/Inputs/system-header-simulator-cxx.h b/test/Analysis/Inputs/system-header-simulator-cxx.h
index 04f1000dbc3fd..005e7f57af6fe 100644
--- a/test/Analysis/Inputs/system-header-simulator-cxx.h
+++ b/test/Analysis/Inputs/system-header-simulator-cxx.h
@@ -10,6 +10,29 @@ typedef unsigned char uint8_t;
typedef __typeof__(sizeof(int)) size_t;
void *memmove(void *s1, const void *s2, size_t n);
+template <typename T, typename Ptr, typename Ref> struct __iterator {
+ typedef __iterator<T, T *, T &> iterator;
+ typedef __iterator<T, const T *, const T &> const_iterator;
+
+ __iterator(const Ptr p) : ptr(p) {}
+
+ __iterator<T, Ptr, Ref> operator++() { return *this; }
+ __iterator<T, Ptr, Ref> operator++(int) { return *this; }
+ __iterator<T, Ptr, Ref> operator--() { return *this; }
+ __iterator<T, Ptr, Ref> operator--(int) { return *this; }
+ Ref operator*() const { return *ptr; }
+ Ptr operator->() const { return *ptr; }
+
+ bool operator==(const iterator &rhs) const { return ptr == rhs.ptr; }
+ bool operator==(const const_iterator &rhs) const { return ptr == rhs.ptr; }
+
+ bool operator!=(const iterator &rhs) const { return ptr != rhs.ptr; }
+ bool operator!=(const const_iterator &rhs) const { return ptr != rhs.ptr; }
+
+private:
+ Ptr ptr;
+};
+
namespace std {
template <class T1, class T2>
struct pair {
@@ -27,6 +50,9 @@ namespace std {
template<typename T>
class vector {
+ typedef __iterator<T, T *, T &> iterator;
+ typedef __iterator<T, const T *, const T &> const_iterator;
+
T *_start;
T *_finish;
T *_end_of_storage;
@@ -49,11 +75,10 @@ namespace std {
return _start[n];
}
- T *begin() { return _start; }
- const T *begin() const { return _start; }
-
- T *end() { return _finish; }
- const T *end() const { return _finish; }
+ iterator begin() { return iterator(_start); }
+ const_iterator begin() const { return const_iterator(_start); }
+ iterator end() { return iterator(_finish); }
+ const_iterator end() const { return const_iterator(_finish); }
};
class exception {
@@ -223,6 +248,35 @@ namespace std {
return __copy_backward(II, IE, OI);
}
+ template <class InputIterator, class T>
+ InputIterator find(InputIterator first, InputIterator last, const T &val);
+ template <class ForwardIterator1, class ForwardIterator2>
+ ForwardIterator1 find_end(ForwardIterator1 first1, ForwardIterator1 last1,
+ ForwardIterator2 first2, ForwardIterator2 last2);
+ template <class ForwardIterator1, class ForwardIterator2>
+ ForwardIterator1 find_first_of(ForwardIterator1 first1,
+ ForwardIterator1 last1,
+ ForwardIterator2 first2,
+ ForwardIterator2 last2);
+ template <class InputIterator, class UnaryPredicate>
+ InputIterator find_if(InputIterator first, InputIterator last,
+ UnaryPredicate pred);
+ template <class InputIterator, class UnaryPredicate>
+ InputIterator find_if_not(InputIterator first, InputIterator last,
+ UnaryPredicate pred);
+ template <class InputIterator, class T>
+ InputIterator lower_bound(InputIterator first, InputIterator last,
+ const T &val);
+ template <class InputIterator, class T>
+ InputIterator upper_bound(InputIterator first, InputIterator last,
+ const T &val);
+ template <class ForwardIterator1, class ForwardIterator2>
+ ForwardIterator1 search(ForwardIterator1 first1, ForwardIterator1 last1,
+ ForwardIterator2 first2, ForwardIterator2 last2);
+ template <class ForwardIterator1, class ForwardIterator2>
+ ForwardIterator1 search_n(ForwardIterator1 first1, ForwardIterator1 last1,
+ ForwardIterator2 first2, ForwardIterator2 last2);
+
struct input_iterator_tag { };
struct output_iterator_tag { };
struct forward_iterator_tag : public input_iterator_tag { };
diff --git a/test/Analysis/diagnostics/explicit-suppression.cpp b/test/Analysis/diagnostics/explicit-suppression.cpp
index 67a47d02b6e95..d36def20f25fd 100644
--- a/test/Analysis/diagnostics/explicit-suppression.cpp
+++ b/test/Analysis/diagnostics/explicit-suppression.cpp
@@ -18,6 +18,6 @@ class C {
void testCopyNull(C *I, C *E) {
std::copy(I, E, (C *)0);
#ifndef SUPPRESSED
- // expected-warning@../Inputs/system-header-simulator-cxx.h:166 {{Called C++ object pointer is null}}
+ // expected-warning@../Inputs/system-header-simulator-cxx.h:191 {{Called C++ object pointer is null}}
#endif
}
diff --git a/test/Analysis/inlining/stl.cpp b/test/Analysis/inlining/stl.cpp
index 95ac3f8172dbd..d89a10983041c 100644
--- a/test/Analysis/inlining/stl.cpp
+++ b/test/Analysis/inlining/stl.cpp
@@ -6,8 +6,7 @@
void clang_analyzer_eval(bool);
void testVector(std::vector<int> &nums) {
- if (nums.begin()) return;
- if (nums.end()) return;
+ if (nums.begin() != nums.end()) return;
clang_analyzer_eval(nums.size() == 0);
#if INLINE
diff --git a/test/Analysis/iterator-past-end.cpp b/test/Analysis/iterator-past-end.cpp
new file mode 100644
index 0000000000000..4d9ed0cf98164
--- /dev/null
+++ b/test/Analysis/iterator-past-end.cpp
@@ -0,0 +1,205 @@
+// RUN: %clang_cc1 -std=c++11 -analyze -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorPastEnd -analyzer-eagerly-assume -analyzer-config c++-container-inlining=false %s -verify
+// RUN: %clang_cc1 -std=c++11 -analyze -analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorPastEnd -analyzer-eagerly-assume -analyzer-config c++-container-inlining=true -DINLINE=1 %s -verify
+
+#include "Inputs/system-header-simulator-cxx.h"
+
+void simple_good(const std::vector<int> &v) {
+ auto i = v.end();
+ if (i != v.end())
+ *i; // no-warning
+}
+
+void simple_good_negated(const std::vector<int> &v) {
+ auto i = v.end();
+ if (!(i == v.end()))
+ *i; // no-warning
+}
+
+void simple_bad(const std::vector<int> &v) {
+ auto i = v.end();
+ *i; // expected-warning{{Iterator accessed past its end}}
+}
+
+void copy(const std::vector<int> &v) {
+ auto i1 = v.end();
+ auto i2 = i1;
+ *i2; // expected-warning{{Iterator accessed past its end}}
+}
+
+void decrease(const std::vector<int> &v) {
+ auto i = v.end();
+ --i;
+ *i; // no-warning
+}
+
+void copy_and_decrease1(const std::vector<int> &v) {
+ auto i1 = v.end();
+ auto i2 = i1;
+ --i1;
+ *i1; // no-warning
+}
+
+void copy_and_decrease2(const std::vector<int> &v) {
+ auto i1 = v.end();
+ auto i2 = i1;
+ --i1;
+ *i2; // expected-warning{{Iterator accessed past its end}}
+}
+
+void copy_and_increase1(const std::vector<int> &v) {
+ auto i1 = v.begin();
+ auto i2 = i1;
+ ++i1;
+ if (i1 == v.end())
+ *i2; // no-warning
+}
+
+void copy_and_increase2(const std::vector<int> &v) {
+ auto i1 = v.begin();
+ auto i2 = i1;
+ ++i1;
+ if (i2 == v.end())
+ *i2; // expected-warning{{Iterator accessed past its end}}
+}
+
+void good_find(std::vector<int> &vec, int e) {
+ auto first = std::find(vec.begin(), vec.end(), e);
+ if (vec.end() != first)
+ *first; // no-warning
+}
+
+void bad_find(std::vector<int> &vec, int e) {
+ auto first = std::find(vec.begin(), vec.end(), e);
+ *first; // expected-warning{{Iterator accessed past its end}}
+}
+
+void good_find_end(std::vector<int> &vec, std::vector<int> &seq) {
+ auto last = std::find_end(vec.begin(), vec.end(), seq.begin(), seq.end());
+ if (vec.end() != last)
+ *last; // no-warning
+}
+
+void bad_find_end(std::vector<int> &vec, std::vector<int> &seq) {
+ auto last = std::find_end(vec.begin(), vec.end(), seq.begin(), seq.end());
+ *last; // expected-warning{{Iterator accessed past its end}}
+}
+
+void good_find_first_of(std::vector<int> &vec, std::vector<int> &seq) {
+ auto first =
+ std::find_first_of(vec.begin(), vec.end(), seq.begin(), seq.end());
+ if (vec.end() != first)
+ *first; // no-warning
+}
+
+void bad_find_first_of(std::vector<int> &vec, std::vector<int> &seq) {
+ auto first = std::find_end(vec.begin(), vec.end(), seq.begin(), seq.end());
+ *first; // expected-warning{{Iterator accessed past its end}}
+}
+
+bool odd(int i) { return i % 2; }
+
+void good_find_if(std::vector<int> &vec) {
+ auto first = std::find_if(vec.begin(), vec.end(), odd);
+ if (vec.end() != first)
+ *first; // no-warning
+}
+
+void bad_find_if(std::vector<int> &vec, int e) {
+ auto first = std::find_if(vec.begin(), vec.end(), odd);
+ *first; // expected-warning{{Iterator accessed past its end}}
+}
+
+void good_find_if_not(std::vector<int> &vec) {
+ auto first = std::find_if_not(vec.begin(), vec.end(), odd);
+ if (vec.end() != first)
+ *first; // no-warning
+}
+
+void bad_find_if_not(std::vector<int> &vec, int e) {
+ auto first = std::find_if_not(vec.begin(), vec.end(), odd);
+ *first; // expected-warning{{Iterator accessed past its end}}
+}
+
+void good_lower_bound(std::vector<int> &vec, int e) {
+ auto first = std::lower_bound(vec.begin(), vec.end(), e);
+ if (vec.end() != first)
+ *first; // no-warning
+}
+
+void bad_lower_bound(std::vector<int> &vec, int e) {
+ auto first = std::lower_bound(vec.begin(), vec.end(), e);
+ *first; // expected-warning{{Iterator accessed past its end}}
+}
+
+void good_upper_bound(std::vector<int> &vec, int e) {
+ auto last = std::lower_bound(vec.begin(), vec.end(), e);
+ if (vec.end() != last)
+ *last; // no-warning
+}
+
+void bad_upper_bound(std::vector<int> &vec, int e) {
+ auto last = std::lower_bound(vec.begin(), vec.end(), e);
+ *last; // expected-warning{{Iterator accessed past its end}}
+}
+
+void good_search(std::vector<int> &vec, std::vector<int> &seq) {
+ auto first = std::search(vec.begin(), vec.end(), seq.begin(), seq.end());
+ if (vec.end() != first)
+ *first; // no-warning
+}
+
+void bad_search(std::vector<int> &vec, std::vector<int> &seq) {
+ auto first = std::search(vec.begin(), vec.end(), seq.begin(), seq.end());
+ *first; // expected-warning{{Iterator accessed past its end}}
+}
+
+void good_search_n(std::vector<int> &vec, std::vector<int> &seq) {
+ auto nth = std::search_n(vec.begin(), vec.end(), seq.begin(), seq.end());
+ if (vec.end() != nth)
+ *nth; // no-warning
+}
+
+void bad_search_n(std::vector<int> &vec, std::vector<int> &seq) {
+ auto nth = std::search_n(vec.begin(), vec.end(), seq.begin(), seq.end());
+ *nth; // expected-warning{{Iterator accessed past its end}}
+}
+
+template <class InputIterator, class T>
+InputIterator nonStdFind(InputIterator first, InputIterator last,
+ const T &val) {
+ for (auto i = first; i != last; ++i) {
+ if (*i == val) {
+ return i;
+ }
+ }
+ return last;
+}
+
+void good_non_std_find(std::vector<int> &vec, int e) {
+ auto first = nonStdFind(vec.begin(), vec.end(), e);
+ if (vec.end() != first)
+ *first; // no-warning
+}
+
+void bad_non_std_find(std::vector<int> &vec, int e) {
+ auto first = nonStdFind(vec.begin(), vec.end(), e);
+ *first; // expected-warning{{Iterator accessed past its end}}
+}
+
+void tricky(std::vector<int> &vec, int e) {
+ const auto first = vec.begin();
+ const auto comp1 = (first != vec.end()), comp2 = (first == vec.end());
+ if (comp1)
+ *first;
+}
+
+void loop(std::vector<int> &vec, int e) {
+ auto start = vec.begin();
+ while (true) {
+ auto item = std::find(start, vec.end(), e);
+ if (item == vec.end())
+ break;
+ *item; // no-warning
+ start = ++item; // no-warning
+ }
+}
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp
index 3e04d5094ac19..74db2b80e70e1 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp
@@ -28,14 +28,23 @@ namespace default_ctor {
struct C;
struct D;
+ struct convert_to_D1 {
+ operator D&&();
+ };
+ struct convert_to_D2 {
+ operator D&&();
+ };
+
struct A { // expected-note 4{{candidate}}
A(); // expected-note {{candidate}}
A(C &&); // expected-note {{candidate}}
C &operator=(C&&); // expected-note {{candidate}}
- A(D &&); // expected-note {{candidate}}
+ A(D &&);
D &operator=(D&&); // expected-note {{candidate}}
+
+ A(convert_to_D2); // expected-note {{candidate}}
};
struct B { // expected-note 4{{candidate}}
@@ -44,8 +53,10 @@ namespace default_ctor {
B(C &&); // expected-note {{candidate}}
C &operator=(C&&); // expected-note {{candidate}}
- B(D &&); // expected-note {{candidate}}
+ B(D &&);
D &operator=(D&&); // expected-note {{candidate}}
+
+ B(convert_to_D2); // expected-note {{candidate}}
};
struct C : A, B {
@@ -75,7 +86,20 @@ namespace default_ctor {
// versions are inherited.
D d; // expected-error {{ambiguous}}
void f(D d) {
- D d2(static_cast<D&&>(d)); // expected-error {{ambiguous}}
+ D d2(static_cast<D&&>(d)); // ok, ignores inherited constructors
+ D d3(convert_to_D1{}); // ok, ignores inherited constructors
+ D d4(convert_to_D2{}); // expected-error {{ambiguous}}
d = static_cast<D&&>(d); // expected-error {{ambiguous}}
}
+
+ struct Y;
+ struct X { // expected-note 2{{candidate}}
+ X();
+ X(volatile Y &); // expected-note {{constructor inherited from base class cannot be used to initialize from an argument of the derived class type}}
+ } x;
+ struct Y : X { using X::X; } volatile y; // expected-note 2{{candidate}}
+ struct Z : Y { using Y::Y; } volatile z; // expected-note 3{{candidate}} expected-note 5{{inherited here}}
+ Z z1(x); // ok
+ Z z2(y); // ok, Z is not reference-related to type of y
+ Z z3(z); // expected-error {{no match}}
}
diff --git a/test/CXX/drs/dr13xx.cpp b/test/CXX/drs/dr13xx.cpp
index 28bebcbb607e6..28e667f77f844 100644
--- a/test/CXX/drs/dr13xx.cpp
+++ b/test/CXX/drs/dr13xx.cpp
@@ -174,3 +174,133 @@ namespace dr1359 { // dr1359: 3.5
constexpr Y y = Y(); // expected-error {{no matching}}
#endif
}
+
+namespace dr1388 { // dr1388: 4.0
+ template<typename A, typename ...T> void f(T..., A); // expected-note 1+{{candidate}} expected-error 0-1{{C++11}}
+ template<typename ...T> void g(T..., int); // expected-note 1+{{candidate}} expected-error 0-1{{C++11}}
+ template<typename ...T, typename A> void h(T..., A); // expected-note 1+{{candidate}} expected-error 0-1{{C++11}}
+
+ void test_f() {
+ f(0); // ok, trailing parameter pack deduced to empty
+ f(0, 0); // expected-error {{no matching}}
+ f<int>(0);
+ f<int>(0, 0); // expected-error {{no matching}}
+ f<int, int>(0, 0);
+ f<int, int, int>(0, 0); // expected-error {{no matching}}
+
+ g(0);
+ g(0, 0); // expected-error {{no matching}}
+ g<>(0);
+ g<int>(0); // expected-error {{no matching}}
+ g<int>(0, 0);
+
+ h(0);
+ h(0, 0); // expected-error {{no matching}}
+ h<int>(0, 0);
+ h<int, int>(0, 0); // expected-error {{no matching}}
+ }
+
+ // A non-trailing parameter pack is still a non-deduced context, even though
+ // we know exactly how many arguments correspond to it.
+ template<typename T, typename U> struct pair {};
+ template<typename ...T> struct tuple { typedef char type; }; // expected-error 0-2{{C++11}}
+ template<typename ...T, typename ...U> void f_pair_1(pair<T, U>..., int); // expected-error 0-2{{C++11}} expected-note {{different lengths (2 vs. 0)}}
+ template<typename ...T, typename U> void f_pair_2(pair<T, char>..., U); // expected-error 0-2{{C++11}}
+ template<typename ...T, typename ...U> void f_pair_3(pair<T, U>..., tuple<U...>); // expected-error 0-2{{C++11}} expected-note {{different lengths (2 vs. 1)}}
+ template<typename ...T> void f_pair_4(pair<T, char>..., T...); // expected-error 0-2{{C++11}} expected-note {{<int, long> vs. <int, long, const char *>}}
+ void g(pair<int, char> a, pair<long, char> b, tuple<char, char> c) {
+ f_pair_1<int, long>(a, b, 0); // expected-error {{no match}}
+ f_pair_2<int, long>(a, b, 0);
+ f_pair_3<int, long>(a, b, c);
+ f_pair_3<int, long>(a, b, tuple<char>()); // expected-error {{no match}}
+ f_pair_4<int, long>(a, b, 0, 0L);
+ f_pair_4<int, long>(a, b, 0, 0L, "foo"); // expected-error {{no match}}
+ }
+}
+
+namespace dr1391 { // dr1391: partial
+ struct A {}; struct B : A {};
+ template<typename T> struct C { C(int); typename T::error error; }; // expected-error 2{{'::'}}
+ template<typename T> struct D {};
+
+ // No deduction is performed for parameters with no deducible template-parameters, therefore types do not need to match.
+ template<typename T> void a(T, int T::*);
+ void test_a(int A::*p) { a(A(), p); } // ok, type of second parameter does not need to match
+
+ namespace dr_example_1 {
+ template<typename T, typename U> void f(C<T>);
+ template<typename T> void f(D<T>);
+
+ void g(D<int> d) {
+ f(d); // ok, first 'f' eliminated by deduction failure
+ f<int>(d); // ok, first 'f' eliminated because 'U' cannot be deduced
+ }
+ }
+
+ namespace dr_example_2 {
+ template<typename T> typename C<T>::error f(int, T);
+ template<typename T> T f(T, T);
+
+ void g(A a) {
+ f(a, a); // ok, no conversion from A to int for first parameter of first candidate
+ }
+ }
+
+ namespace std_example {
+ template<typename T> struct Z {
+ typedef typename T::x xx;
+ };
+ template<typename T> typename Z<T>::xx f(void *, T);
+ template<typename T> void f(int, T);
+ struct A {} a;
+ void g() { f(1, a); }
+ }
+
+ template<typename T> void b(C<int> ci, T *p);
+ void b(...);
+ void test_b() {
+ b(0, 0); // ok, deduction fails prior to forming a conversion sequence and instantiating C<int>
+ // FIXME: The "while substituting" note should point at the overload candidate.
+ b<int>(0, 0); // expected-note {{instantiation of}} expected-note {{while substituting}}
+ }
+
+ template<typename T> struct Id { typedef T type; };
+ template<typename T> void c(T, typename Id<C<T> >::type);
+ void test_c() {
+ // Implicit conversion sequences for dependent types are checked later.
+ c(0.0, 0); // expected-note {{instantiation of}}
+ }
+
+ namespace partial_ordering {
+ // FIXME: Second template should be considered more specialized because non-dependent parameter is ignored.
+ template<typename T> int a(T, short) = delete; // expected-error 0-1{{extension}} expected-note {{candidate}}
+ template<typename T> int a(T*, char); // expected-note {{candidate}}
+ int test_a = a((int*)0, 0); // FIXME: expected-error {{ambiguous}}
+
+ // FIXME: Second template should be considered more specialized:
+ // deducing #1 from #2 ignores the second P/A pair, so deduction succeeds,
+ // deducing #2 from #1 fails to deduce T, so deduction fails.
+ template<typename T> int b(T, int) = delete; // expected-error 0-1{{extension}} expected-note {{candidate}}
+ template<typename T, typename U> int b(T*, U); // expected-note {{candidate}}
+ int test_b = b((int*)0, 0); // FIXME: expected-error {{ambiguous}}
+
+ // Unintended consequences: because partial ordering does not consider
+ // explicit template arguments, and deduction from a non-dependent type
+ // vacuously succeeds, a non-dependent template is less specialized than
+ // anything else!
+ // According to DR1391, this is ambiguous!
+ template<typename T> int c(int);
+ template<typename T> int c(T);
+ int test_c1 = c(0); // ok
+ int test_c2 = c<int>(0); // FIXME: apparently ambiguous
+ }
+}
+
+namespace dr1399 { // dr1399: dup 1388
+ template<typename ...T> void f(T..., int, T...) {} // expected-note {{candidate}} expected-error 0-1{{C++11}}
+ void g() {
+ f(0);
+ f<int>(0, 0, 0);
+ f(0, 0, 0); // expected-error {{no match}}
+ }
+}
diff --git a/test/CXX/drs/dr19xx.cpp b/test/CXX/drs/dr19xx.cpp
index 5b626dd80892b..15ed30583fd01 100644
--- a/test/CXX/drs/dr19xx.cpp
+++ b/test/CXX/drs/dr19xx.cpp
@@ -140,7 +140,7 @@ namespace dr1959 { // dr1959: 3.9
a() = default;
a(const a &) = delete; // expected-note 2{{deleted}}
a(const b &) = delete; // not inherited
- a(c &&) = delete; // expected-note {{deleted}}
+ a(c &&) = delete;
template<typename T> a(T) = delete;
};
@@ -152,13 +152,14 @@ namespace dr1959 { // dr1959: 3.9
b y = x; // expected-error {{deleted}}
b z = z; // expected-error {{deleted}}
- // FIXME: It's not really clear that this matches the intent, but it's
- // consistent with the behavior for assignment operators.
struct c : a {
using a::a;
c(const c &);
};
- c q(static_cast<c&&>(q)); // expected-error {{call to deleted}}
+ // FIXME: As a resolution to an open DR against P0136R0, we disallow
+ // use of inherited constructors to construct from a single argument
+ // where the derived class is reference-related to its type.
+ c q(static_cast<c&&>(q));
#endif
}
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp
index e40761770d555..31213c9ebc334 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp
@@ -139,11 +139,11 @@ namespace NonLocalLambdaInstantation {
}
template<typename T>
- struct X2 { // expected-note{{in instantiation of default member initializer 'NonLocalLambdaInstantation::X2<int *>::x' requested here}}
+ struct X2 {
int x = []{ return T(); }(); // expected-error{{cannot initialize a member subobject of type 'int' with an rvalue of type 'int *'}}
};
X2<int> x2i;
X2<float> x2f;
- X2<int*> x2ip; // expected-note{{implicit default constructor for 'NonLocalLambdaInstantation::X2<int *>' first required here}}
+ X2<int*> x2ip; // expected-note{{in instantiation of default member initializer 'NonLocalLambdaInstantation::X2<int *>::x'}}
}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
index cd1d9f15c725e..081bba2b8dffc 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
@@ -76,14 +76,17 @@ void test_pair_deduction(int *ip, float *fp, double *dp) {
first_arg_pair(make_pair(ip, 17), 16); // expected-error{{no matching function for call to 'first_arg_pair'}}
}
-// For a function parameter pack that does not occur at the end of the
-// parameter-declaration-list, the type of the parameter pack is a
-// non-deduced context.
+// A function parameter pack not at the end of the parameter list is never
+// deduced. We interpret this as meaning the types within it are never
+// deduced, and thus must match explicitly-specified values.
template<typename ...Types> struct tuple { };
template<typename ...Types>
-void pack_not_at_end(tuple<Types...>, Types... values, int);
+void pack_not_at_end(tuple<Types...>, Types... values, int); // expected-note {{<int *, double *> vs. <>}}
void test_pack_not_at_end(tuple<int*, double*> t2) {
- pack_not_at_end(t2, 0, 0, 0);
+ pack_not_at_end(t2, 0, 0, 0); // expected-error {{no match}}
+ // FIXME: Should the "original argument type must match deduced parameter
+ // type" rule apply here?
+ pack_not_at_end<int*, double*>(t2, 0, 0, 0); // ok
}
diff --git a/test/CXX/temp/temp.param/p5.cpp b/test/CXX/temp/temp.param/p5.cpp
index ab430fb8741f8..aa0d7e92b9ec5 100644
--- a/test/CXX/temp/temp.param/p5.cpp
+++ b/test/CXX/temp/temp.param/p5.cpp
@@ -1,13 +1,13 @@
-// RUN: %clang_cc1 -verify %s -std=c++11
+// RUN: %clang_cc1 -verify %s -std=c++14
-template<const int I> struct S { // expected-note {{instantiation}}
+template<const int I> struct S {
decltype(I) n;
int &&r = I; // expected-warning 2{{binding reference member 'r' to a temporary value}} expected-note 2{{declared here}}
};
-S<5> s;
+S<5> s; // expected-note {{instantiation}}
-template<typename T, T v> struct U { // expected-note {{instantiation}}
+template<typename T, T v> struct U {
decltype(v) n;
int &&r = v; // expected-warning {{binding reference member 'r' to a temporary value}} expected-note {{declared here}}
};
-U<const int, 6> u;
+U<const int, 6> u; // expected-note {{instantiation}}
diff --git a/test/CodeGen/lifetime2.c b/test/CodeGen/lifetime2.c
index 0d22282fdd437..4374b3c279c70 100644
--- a/test/CodeGen/lifetime2.c
+++ b/test/CodeGen/lifetime2.c
@@ -1,4 +1,6 @@
// RUN: %clang -S -emit-llvm -o - -O2 %s | FileCheck %s -check-prefixes=CHECK,O2
+// RUN: %clang -S -emit-llvm -o - -O2 -Xclang -disable-lifetime-markers %s \
+// RUN: | FileCheck %s -check-prefixes=CHECK,O0
// RUN: %clang -S -emit-llvm -o - -O0 %s | FileCheck %s -check-prefixes=CHECK,O0
extern int bar(char *A, int n);
diff --git a/test/CodeGen/thinlto_backend.ll b/test/CodeGen/thinlto_backend.ll
index 89f4fc407fbce..ac0b3b76ef7d1 100644
--- a/test/CodeGen/thinlto_backend.ll
+++ b/test/CodeGen/thinlto_backend.ll
@@ -12,6 +12,14 @@
; RUN: %clang -O2 -o %t4.o -x ir %t1.o -c -fthinlto-index=bad.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-ERROR1
; CHECK-ERROR1: Error loading index file 'bad.thinlto.bc'
+; Ensure we ignore empty index file under -ignore-empty-index-file, and run
+; non-ThinLTO compilation which would not import f2
+; RUN: touch %t4.thinlto.bc
+; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t4.o -x ir %t1.o -c -fthinlto-index=%t4.thinlto.bc -mllvm -ignore-empty-index-file
+; RUN: llvm-nm %t4.o | FileCheck --check-prefix=CHECK-OBJ-IGNORE-EMPTY %s
+; CHECK-OBJ-IGNORE-EMPTY: T f1
+; CHECK-OBJ-IGNORE-EMPTY: U f2
+
; Ensure f2 was imported
; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t3.o -x ir %t1.o -c -fthinlto-index=%t.thinlto.bc
; RUN: llvm-nm %t3.o | FileCheck --check-prefix=CHECK-OBJ %s
diff --git a/test/CodeGenCXX/arm.cpp b/test/CodeGenCXX/arm.cpp
index d0b896d182da9..7eba017e37f23 100644
--- a/test/CodeGenCXX/arm.cpp
+++ b/test/CodeGenCXX/arm.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -o - -fexceptions | FileCheck %s
+// RUN: %clang_cc1 %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -std=gnu++98 -o - -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -std=gnu++11 -o - -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
// CHECK: @_ZZN5test74testEvE1x = internal global i32 0, align 4
// CHECK: @_ZGVZN5test74testEvE1x = internal global i32 0
@@ -156,7 +157,8 @@ namespace test3 {
// CHECK: getelementptr {{.*}}, i32 4
// CHECK: bitcast {{.*}} to i32*
// CHECK: load
- // CHECK: invoke {{.*}} @_ZN5test31AD1Ev
+ // CHECK98: invoke {{.*}} @_ZN5test31AD1Ev
+ // CHECK11: call {{.*}} @_ZN5test31AD1Ev
// CHECK: call void @_ZdaPv
delete [] x;
}
@@ -168,7 +170,8 @@ namespace test3 {
// CHECK: getelementptr {{.*}}, i32 4
// CHECK: bitcast {{.*}} to i32*
// CHECK: load
- // CHECK: invoke {{.*}} @_ZN5test31AD1Ev
+ // CHECK98: invoke {{.*}} @_ZN5test31AD1Ev
+ // CHECK11: call {{.*}} @_ZN5test31AD1Ev
// CHECK: call void @_ZdaPv
delete [] x;
}
diff --git a/test/CodeGenCXX/debug-info-class.cpp b/test/CodeGenCXX/debug-info-class.cpp
index d572eef68abf6..e06ef8dfda5b4 100644
--- a/test/CodeGenCXX/debug-info-class.cpp
+++ b/test/CodeGenCXX/debug-info-class.cpp
@@ -83,12 +83,17 @@ int main(int argc, char **argv) {
return 0;
}
-// RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=limited -fexceptions %s -o - | FileCheck %s
-// RUN: %clang_cc1 -triple i686-cygwin -emit-llvm -debug-info-kind=limited -fexceptions %s -o - | FileCheck %s
-// RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -debug-info-kind=limited -fexceptions %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=limited -fexceptions -std=c++98 %s -o - | FileCheck -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 -triple i686-cygwin -emit-llvm -debug-info-kind=limited -fexceptions -std=c++98 %s -o - | FileCheck -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -debug-info-kind=limited -fexceptions -std=c++98 %s -o - | FileCheck -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=limited -fexceptions -std=c++11 %s -o - | FileCheck -check-prefix=CHECK11 %s
+// RUN: %clang_cc1 -triple i686-cygwin -emit-llvm -debug-info-kind=limited -fexceptions -std=c++11 %s -o - | FileCheck -check-prefix=CHECK11 %s
+// RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -debug-info-kind=limited -fexceptions -std=c++11 %s -o - | FileCheck -check-prefix=CHECK11 %s
+
+// CHECK98: invoke {{.+}} @_ZN1BD1Ev(%class.B* %b)
+// CHECK98-NEXT: unwind label %{{.+}}, !dbg ![[EXCEPTLOC:.*]]
+// CHECK11: call {{.+}} @_ZN1BD1Ev(%class.B* %b){{.*}}, !dbg ![[EXCEPTLOC:.*]]
-// CHECK: invoke {{.+}} @_ZN1BD1Ev(%class.B* %b)
-// CHECK-NEXT: unwind label %{{.+}}, !dbg ![[EXCEPTLOC:.*]]
// CHECK: store i32 0, i32* %{{.+}}, !dbg ![[RETLOC:.*]]
// CHECK: [[F:![0-9]*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "F"
diff --git a/test/CodeGenCXX/dllexport-ctor-closure.cpp b/test/CodeGenCXX/dllexport-ctor-closure.cpp
new file mode 100644
index 0000000000000..4fae7e10e8b6c
--- /dev/null
+++ b/test/CodeGenCXX/dllexport-ctor-closure.cpp
@@ -0,0 +1,82 @@
+// RUN: %clang_cc1 -triple i686-windows-msvc -emit-llvm -std=c++14 \
+// RUN: -fno-threadsafe-statics -fms-extensions -O1 -mconstructor-aliases \
+// RUN: -disable-llvm-passes -o - %s -w -fms-compatibility-version=19.00 | \
+// RUN: FileCheck %s
+
+struct CtorWithClosure {
+ __declspec(dllexport) CtorWithClosure(...) {}
+// CHECK-LABEL: define weak_odr dllexport x86_thiscallcc void @"\01??_FCtorWithClosure@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
+// CHECK: %[[this_addr:.*]] = alloca %struct.CtorWithClosure*, align 4
+// CHECK: store %struct.CtorWithClosure* %this, %struct.CtorWithClosure** %[[this_addr]], align 4
+// CHECK: %[[this:.*]] = load %struct.CtorWithClosure*, %struct.CtorWithClosure** %[[this_addr]]
+// CHECK: call %struct.CtorWithClosure* (%struct.CtorWithClosure*, ...) @"\01??0CtorWithClosure@@QAA@ZZ"(%struct.CtorWithClosure* %[[this]])
+// CHECK: ret void
+};
+
+struct CtorWithClosureOutOfLine {
+ __declspec(dllexport) CtorWithClosureOutOfLine(...);
+};
+CtorWithClosureOutOfLine::CtorWithClosureOutOfLine(...) {}
+// CHECK-LABEL: define weak_odr dllexport x86_thiscallcc void @"\01??_FCtorWithClosureOutOfLine@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
+
+#define DELETE_IMPLICIT_MEMBERS(ClassName) \
+ ClassName(ClassName &&) = delete; \
+ ClassName(ClassName &) = delete; \
+ ~ClassName() = delete; \
+ ClassName &operator=(ClassName &) = delete
+
+struct __declspec(dllexport) ClassWithClosure {
+ DELETE_IMPLICIT_MEMBERS(ClassWithClosure);
+ ClassWithClosure(...) {}
+// CHECK-LABEL: define weak_odr dllexport x86_thiscallcc void @"\01??_FClassWithClosure@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
+// CHECK: %[[this_addr:.*]] = alloca %struct.ClassWithClosure*, align 4
+// CHECK: store %struct.ClassWithClosure* %this, %struct.ClassWithClosure** %[[this_addr]], align 4
+// CHECK: %[[this:.*]] = load %struct.ClassWithClosure*, %struct.ClassWithClosure** %[[this_addr]]
+// CHECK: call %struct.ClassWithClosure* (%struct.ClassWithClosure*, ...) @"\01??0ClassWithClosure@@QAA@ZZ"(%struct.ClassWithClosure* %[[this]])
+// CHECK: ret void
+};
+
+template <typename T> struct TemplateWithClosure {
+ TemplateWithClosure(int x = sizeof(T)) {}
+};
+extern template struct TemplateWithClosure<char>;
+template struct __declspec(dllexport) TemplateWithClosure<char>;
+extern template struct TemplateWithClosure<int>;
+template struct __declspec(dllexport) TemplateWithClosure<int>;
+
+// CHECK-LABEL: define weak_odr dllexport x86_thiscallcc void @"\01??_F?$TemplateWithClosure@D@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
+// CHECK: call {{.*}} @"\01??0?$TemplateWithClosure@D@@QAE@H@Z"({{.*}}, i32 1)
+
+// CHECK-LABEL: define weak_odr dllexport x86_thiscallcc void @"\01??_F?$TemplateWithClosure@H@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
+// CHECK: call {{.*}} @"\01??0?$TemplateWithClosure@H@@QAE@H@Z"({{.*}}, i32 4)
+
+struct __declspec(dllexport) NestedOuter {
+ DELETE_IMPLICIT_MEMBERS(NestedOuter);
+ NestedOuter(void *p = 0) {}
+ struct __declspec(dllexport) NestedInner {
+ DELETE_IMPLICIT_MEMBERS(NestedInner);
+ NestedInner(void *p = 0) {}
+ };
+};
+
+// CHECK-LABEL: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedOuter@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
+// CHECK-LABEL: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedInner@NestedOuter@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
+
+struct HasDtor {
+ ~HasDtor();
+ int o;
+};
+struct HasImplicitDtor1 { HasDtor o; };
+struct HasImplicitDtor2 { HasDtor o; };
+struct __declspec(dllexport) CtorClosureInline {
+ CtorClosureInline(const HasImplicitDtor1 &v = {}) {}
+};
+struct __declspec(dllexport) CtorClosureOutOfLine {
+ CtorClosureOutOfLine(const HasImplicitDtor2 &v = {});
+};
+CtorClosureOutOfLine::CtorClosureOutOfLine(const HasImplicitDtor2 &v) {}
+
+// CHECK-LABEL: define weak_odr dllexport x86_thiscallcc void @"\01??_FCtorClosureInline@@QAEXXZ"
+// CHECK-LABEL: define linkonce_odr x86_thiscallcc void @"\01??1HasImplicitDtor1@@QAE@XZ"
+// CHECK-LABEL: define weak_odr dllexport x86_thiscallcc void @"\01??_FCtorClosureOutOfLine@@QAEXXZ"
+// CHECK-LABEL: define linkonce_odr x86_thiscallcc void @"\01??1HasImplicitDtor2@@QAE@XZ"
diff --git a/test/CodeGenCXX/dllexport.cpp b/test/CodeGenCXX/dllexport.cpp
index 116176e2cb928..fe40bc0aac129 100644
--- a/test/CodeGenCXX/dllexport.cpp
+++ b/test/CodeGenCXX/dllexport.cpp
@@ -488,57 +488,6 @@ struct S {
};
};
-struct CtorWithClosure {
- __declspec(dllexport) CtorWithClosure(...) {}
-// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FCtorWithClosure@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
-// M32-DAG: %[[this_addr:.*]] = alloca %struct.CtorWithClosure*, align 4
-// M32-DAG: store %struct.CtorWithClosure* %this, %struct.CtorWithClosure** %[[this_addr]], align 4
-// M32-DAG: %[[this:.*]] = load %struct.CtorWithClosure*, %struct.CtorWithClosure** %[[this_addr]]
-// M32-DAG: call %struct.CtorWithClosure* (%struct.CtorWithClosure*, ...) @"\01??0CtorWithClosure@@QAA@ZZ"(%struct.CtorWithClosure* %[[this]])
-// M32-DAG: ret void
-};
-
-#define DELETE_IMPLICIT_MEMBERS(ClassName) \
- ClassName(ClassName &&) = delete; \
- ClassName(ClassName &) = delete; \
- ~ClassName() = delete; \
- ClassName &operator=(ClassName &) = delete
-
-struct __declspec(dllexport) ClassWithClosure {
- DELETE_IMPLICIT_MEMBERS(ClassWithClosure);
- ClassWithClosure(...) {}
-// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FClassWithClosure@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
-// M32-DAG: %[[this_addr:.*]] = alloca %struct.ClassWithClosure*, align 4
-// M32-DAG: store %struct.ClassWithClosure* %this, %struct.ClassWithClosure** %[[this_addr]], align 4
-// M32-DAG: %[[this:.*]] = load %struct.ClassWithClosure*, %struct.ClassWithClosure** %[[this_addr]]
-// M32-DAG: call %struct.ClassWithClosure* (%struct.ClassWithClosure*, ...) @"\01??0ClassWithClosure@@QAA@ZZ"(%struct.ClassWithClosure* %[[this]])
-// M32-DAG: ret void
-};
-
-template <typename T> struct TemplateWithClosure {
- TemplateWithClosure(int x = sizeof(T)) {}
-};
-extern template struct TemplateWithClosure<char>;
-template struct __declspec(dllexport) TemplateWithClosure<char>;
-extern template struct TemplateWithClosure<int>;
-template struct __declspec(dllexport) TemplateWithClosure<int>;
-// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_F?$TemplateWithClosure@D@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
-// M32-DAG: call {{.*}} @"\01??0?$TemplateWithClosure@D@@QAE@H@Z"({{.*}}, i32 1)
-// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_F?$TemplateWithClosure@H@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
-// M32-DAG: call {{.*}} @"\01??0?$TemplateWithClosure@H@@QAE@H@Z"({{.*}}, i32 4)
-
-struct __declspec(dllexport) NestedOuter {
- DELETE_IMPLICIT_MEMBERS(NestedOuter);
- NestedOuter(void *p = 0) {}
- struct __declspec(dllexport) NestedInner {
- DELETE_IMPLICIT_MEMBERS(NestedInner);
- NestedInner(void *p = 0) {}
- };
-};
-
-// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedOuter@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
-// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedInner@NestedOuter@@QAEXXZ"({{.*}}) {{#[0-9]+}} comdat
-
template <typename T>
struct SomeTemplate {
SomeTemplate(T o = T()) : o(o) {}
diff --git a/test/CodeGenCXX/eh-aggregate-copy-destroy.cpp b/test/CodeGenCXX/eh-aggregate-copy-destroy.cpp
index 29fb5567fb1d9..9f0f36c875618 100644
--- a/test/CodeGenCXX/eh-aggregate-copy-destroy.cpp
+++ b/test/CodeGenCXX/eh-aggregate-copy-destroy.cpp
@@ -1,7 +1,8 @@
// Check that in case of copying an array of memcpy-able objects, their
// destructors will be called if an exception is thrown.
//
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fexceptions -fcxx-exceptions -O0 -fno-elide-constructors -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fexceptions -fcxx-exceptions -O0 -fno-elide-constructors -std=c++98 -emit-llvm %s -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fexceptions -fcxx-exceptions -O0 -fno-elide-constructors -std=c++11 -emit-llvm %s -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
struct ImplicitCopy {
int x;
@@ -25,7 +26,8 @@ int main () {
// CHECK_LABEL: main
// CHECK-NOT: call void @_ZN9ThrowCopyC1ERKS_
// CHECK: invoke void @_ZN9ThrowCopyC1ERKS_
- // CHECK: invoke void @_ZN12ImplicitCopyD1Ev
+ // CHECK98: invoke void @_ZN12ImplicitCopyD1Ev
+ // CHECK11: call void @_ZN12ImplicitCopyD1Ev
Container c2(c1);
}
catch (...) {
diff --git a/test/CodeGenCXX/exceptions.cpp b/test/CodeGenCXX/exceptions.cpp
index 86616d1e2c624..e31d6fc2797b1 100644
--- a/test/CodeGenCXX/exceptions.cpp
+++ b/test/CodeGenCXX/exceptions.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -std=c++98 -o - -fcxx-exceptions -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -std=c++11 -o - -fcxx-exceptions -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
typedef __typeof(sizeof(0)) size_t;
@@ -64,7 +65,10 @@ namespace test1 {
// CHECK-NEXT: [[T2:%.*]] = load i32, i32* [[T1]], align 4
// CHECK-NEXT: invoke void @_ZN5test11AC1Ei([[A]]* [[CAST]], i32 [[T2]])
// CHECK: store i1 false, i1* [[ACTIVE]]
- // CHECK-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
+ // CHECK98-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+ // CHECK11-NEXT: call void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
// CHECK: ret [[A]]* [[CAST]]
// CHECK: [[ISACTIVE:%.*]] = load i1, i1* [[ACTIVE]]
// CHECK-NEXT: br i1 [[ISACTIVE]]
@@ -74,10 +78,10 @@ namespace test1 {
// rdar://11904428
// Terminate landing pads should call __cxa_begin_catch first.
- // CHECK: define linkonce_odr hidden void @__clang_call_terminate(i8*) [[NI_NR_NUW:#[0-9]+]] comdat
- // CHECK-NEXT: [[T0:%.*]] = call i8* @__cxa_begin_catch(i8* %0) [[NUW:#[0-9]+]]
- // CHECK-NEXT: call void @_ZSt9terminatev() [[NR_NUW:#[0-9]+]]
- // CHECK-NEXT: unreachable
+ // CHECK98: define linkonce_odr hidden void @__clang_call_terminate(i8*) [[NI_NR_NUW:#[0-9]+]] comdat
+ // CHECK98-NEXT: [[T0:%.*]] = call i8* @__cxa_begin_catch(i8* %0) [[NUW:#[0-9]+]]
+ // CHECK98-NEXT: call void @_ZSt9terminatev() [[NR_NUW:#[0-9]+]]
+ // CHECK98-NEXT: unreachable
A *d() {
// CHECK: define [[A:%.*]]* @_ZN5test11dEv()
@@ -89,7 +93,10 @@ namespace test1 {
// CHECK: [[T1:%.*]] = invoke i32 @_ZN5test11BcviEv([[B]]* [[T0]])
// CHECK: invoke void @_ZN5test11AC1Ei([[A]]* [[CAST]], i32 [[T1]])
// CHECK: store i1 false, i1* [[ACTIVE]]
- // CHECK-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
+ // CHECK98-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+ // CHECK11-NEXT: call void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
// CHECK: ret [[A]]* [[CAST]]
// CHECK: [[ISACTIVE:%.*]] = load i1, i1* [[ACTIVE]]
// CHECK-NEXT: br i1 [[ISACTIVE]]
@@ -109,8 +116,13 @@ namespace test1 {
// CHECK: [[T3:%.*]] = invoke i32 @_ZN5test11BcviEv([[B]]* [[T2]])
// CHECK: invoke void @_ZN5test11AC1Eii([[A]]* [[CAST]], i32 [[T1]], i32 [[T3]])
// CHECK: store i1 false, i1* [[ACTIVE]]
- // CHECK-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T2]])
- // CHECK: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
+ // CHECK98-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T2]])
+ // CHECK11-NEXT: call void @_ZN5test11BD1Ev([[B]]* [[T2]])
+
+ // CHECK98: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+ // CHECK11: call void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
// CHECK: ret [[A]]* [[CAST]]
// CHECK: [[ISACTIVE:%.*]] = load i1, i1* [[ACTIVE]]
// CHECK-NEXT: br i1 [[ISACTIVE]]
@@ -141,8 +153,13 @@ namespace test1 {
// CHECK-NEXT: store [[A]]* [[CAST]], [[A]]** [[X]], align 8
// CHECK: invoke void @_ZN5test15makeBEv([[B:%.*]]* sret [[T2:%.*]])
// CHECK: [[RET:%.*]] = load [[A]]*, [[A]]** [[X]], align 8
- // CHECK: invoke void @_ZN5test11BD1Ev([[B]]* [[T2]])
- // CHECK: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
+ // CHECK98: invoke void @_ZN5test11BD1Ev([[B]]* [[T2]])
+ // CHECK11: call void @_ZN5test11BD1Ev([[B]]* [[T2]])
+
+ // CHECK98: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+ // CHECK11: call void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
// CHECK: ret [[A]]* [[RET]]
// CHECK: [[ISACTIVE:%.*]] = load i1, i1* [[ACTIVE]]
// CHECK-NEXT: br i1 [[ISACTIVE]]
@@ -166,8 +183,11 @@ namespace test2 {
// CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
// CHECK-NEXT: invoke void @_ZN5test21AC1Ei([[A]]* [[CAST]], i32 5)
// CHECK: ret [[A]]* [[CAST]]
- // CHECK: invoke void @_ZN5test21AdlEPvm(i8* [[NEW]], i64 8)
- // CHECK: call void @__clang_call_terminate(i8* {{%.*}}) [[NR_NUW]]
+
+ // CHECK98: invoke void @_ZN5test21AdlEPvm(i8* [[NEW]], i64 8)
+ // CHECK11: call void @_ZN5test21AdlEPvm(i8* [[NEW]], i64 8)
+
+ // CHECK98: call void @__clang_call_terminate(i8* {{%.*}}) [[NR_NUW]]
return new A(5);
}
}
@@ -192,8 +212,11 @@ namespace test3 {
// CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
// CHECK-NEXT: invoke void @_ZN5test31AC1Ei([[A]]* [[CAST]], i32 5)
// CHECK: ret [[A]]* [[CAST]]
- // CHECK: invoke void @_ZN5test31AdlEPvS1_d(i8* [[NEW]], i8* [[FOO]], double [[BAR]])
- // CHECK: call void @__clang_call_terminate(i8* {{%.*}}) [[NR_NUW]]
+
+ // CHECK98: invoke void @_ZN5test31AdlEPvS1_d(i8* [[NEW]], i8* [[FOO]], double [[BAR]])
+ // CHECK11: call void @_ZN5test31AdlEPvS1_d(i8* [[NEW]], i8* [[FOO]], double [[BAR]])
+
+ // CHECK98: call void @__clang_call_terminate(i8* {{%.*}}) [[NR_NUW]]
return new(foo(),bar()) A(5);
}
@@ -235,7 +258,9 @@ namespace test3 {
// CHECK-NEXT: br i1 [[ISACTIVE]]
// CHECK: [[V0:%.*]] = load i8*, i8** [[SAVED0]]
// CHECK-NEXT: [[V1:%.*]] = load i8*, i8** [[SAVED1]]
- // CHECK-NEXT: invoke void @_ZN5test31AdlEPvS1_d(i8* [[V0]], i8* [[V1]], double [[CONST]])
+
+ // CHECK98-NEXT: invoke void @_ZN5test31AdlEPvS1_d(i8* [[V0]], i8* [[V1]], double [[CONST]])
+ // CHECK11-NEXT: call void @_ZN5test31AdlEPvS1_d(i8* [[V0]], i8* [[V1]], double [[CONST]])
}
}
@@ -283,9 +308,13 @@ namespace test5 {
// CHECK-NEXT: [[SRC:%.*]] = bitcast i8* [[ADJ]] to [[A_T]]*
// CHECK-NEXT: invoke void @_ZN5test51TC1Ev([[T_T]]* [[T]])
// CHECK: invoke void @_ZN5test51AC1ERKS0_RKNS_1TE([[A_T]]* [[A]], [[A_T]]* dereferenceable({{[0-9]+}}) [[SRC]], [[T_T]]* dereferenceable({{[0-9]+}}) [[T]])
- // CHECK: invoke void @_ZN5test51TD1Ev([[T_T]]* [[T]])
- // CHECK: call i8* @__cxa_begin_catch(i8* [[EXN]]) [[NUW]]
- // CHECK-NEXT: invoke void @_ZN5test51AD1Ev([[A_T]]* [[A]])
+
+ // CHECK98: invoke void @_ZN5test51TD1Ev([[T_T]]* [[T]])
+ // CHECK11: call void @_ZN5test51TD1Ev([[T_T]]* [[T]])
+
+ // CHECK98: call i8* @__cxa_begin_catch(i8* [[EXN]]) [[NUW]]
+ // CHECK98-NEXT: invoke void @_ZN5test51AD1Ev([[A_T]]* [[A]])
+
// CHECK: call void @__cxa_end_catch()
void test() {
try {
@@ -380,12 +409,16 @@ namespace test7 {
// Destroy the inner A object.
// CHECK-NEXT: load i1, i1* [[INNER_A]]
// CHECK-NEXT: br i1
- // CHECK: invoke void @_ZN5test71AD1Ev(
+
+ // CHECK98: invoke void @_ZN5test71AD1Ev(
+ // CHECK11: call void @_ZN5test71AD1Ev(
// Destroy the outer A object.
// CHECK: load i1, i1* [[OUTER_A]]
// CHECK-NEXT: br i1
- // CHECK: invoke void @_ZN5test71AD1Ev(
+
+ // CHECK98: invoke void @_ZN5test71AD1Ev(
+ // CHECK11: call void @_ZN5test71AD1Ev(
return new B(A(), new B(A(), 0));
}
@@ -456,8 +489,12 @@ namespace test10 {
// CHECK-NEXT: load i8, i8* @_ZN6test108suppressE, align 1
// CHECK-NEXT: trunc
// CHECK-NEXT: br i1
- // CHECK: call void @__cxa_end_catch()
- // CHECK-NEXT: br label
+
+ // CHECK98: call void @__cxa_end_catch()
+ // CHECK98-NEXT: br label
+ // CHECK11: invoke void @__cxa_end_catch()
+ // CHECK11-NEXT: to label
+
// CHECK: invoke void @__cxa_rethrow()
// CHECK: unreachable
}
@@ -504,7 +541,10 @@ namespace test11 {
// CHECK-NEXT: br i1 [[EMPTY]]
// CHECK: [[AFTER:%.*]] = phi [[A]]* [ [[CUR]], {{%.*}} ], [ [[ELT:%.*]], {{%.*}} ]
// CHECK-NEXT: [[ELT]] = getelementptr inbounds [[A]], [[A]]* [[AFTER]], i64 -1
- // CHECK-NEXT: invoke void @_ZN6test111AD1Ev([[A]]* [[ELT]])
+
+ // CHECK98-NEXT: invoke void @_ZN6test111AD1Ev([[A]]* [[ELT]])
+ // CHECK11-NEXT: call void @_ZN6test111AD1Ev([[A]]* [[ELT]])
+
// CHECK: [[DONE:%.*]] = icmp eq [[A]]* [[ELT]], [[ARRAYBEGIN]]
// CHECK-NEXT: br i1 [[DONE]],
// - Next, chain to cleanup for single.
@@ -517,13 +557,19 @@ namespace test11 {
// CHECK-NEXT: br label
// CHECK: [[AFTER:%.*]] = phi [[A]]* [ [[ARRAYEND]], {{%.*}} ], [ [[ELT:%.*]], {{%.*}} ]
// CHECK-NEXT: [[ELT]] = getelementptr inbounds [[A]], [[A]]* [[AFTER]], i64 -1
- // CHECK-NEXT: invoke void @_ZN6test111AD1Ev([[A]]* [[ELT]])
+
+ // CHECK98-NEXT: invoke void @_ZN6test111AD1Ev([[A]]* [[ELT]])
+ // CHECK11-NEXT: call void @_ZN6test111AD1Ev([[A]]* [[ELT]])
+
// CHECK: [[DONE:%.*]] = icmp eq [[A]]* [[ELT]], [[ARRAYBEGIN]]
// CHECK-NEXT: br i1 [[DONE]],
// - Next, chain to cleanup for single.
// CHECK: br label
// Finally, the cleanup for single.
- // CHECK: invoke void @_ZN6test111AD1Ev([[A]]* [[SINGLE]])
+
+ // CHECK98: invoke void @_ZN6test111AD1Ev([[A]]* [[SINGLE]])
+ // CHECK11: call void @_ZN6test111AD1Ev([[A]]* [[SINGLE]])
+
// CHECK: br label
// CHECK: resume
// (After this is a terminate landingpad.)
@@ -543,7 +589,9 @@ namespace test12 {
// CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[PTR]] to [[A:%.*]]*
// CHECK-NEXT: invoke void @_ZN6test121AC1Ev([[A]]* [[CAST]])
// CHECK: ret [[A]]* [[CAST]]
- // CHECK: invoke void @_ZN6test121AdlEPvS1_(i8* [[PTR]], i8* [[PTR]])
+
+ // CHECK98: invoke void @_ZN6test121AdlEPvS1_(i8* [[PTR]], i8* [[PTR]])
+ // CHECK11: call void @_ZN6test121AdlEPvS1_(i8* [[PTR]], i8* [[PTR]])
}
-// CHECK: attributes [[NI_NR_NUW]] = { noinline noreturn nounwind }
+// CHECK98: attributes [[NI_NR_NUW]] = { noinline noreturn nounwind }
diff --git a/test/CodeGenCXX/goto.cpp b/test/CodeGenCXX/goto.cpp
index 27bd7affbac9b..2f5b7197ca0ed 100644
--- a/test/CodeGenCXX/goto.cpp
+++ b/test/CodeGenCXX/goto.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -std=c++98 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
// Reduced from a crash on boost::interprocess's node_allocator_test.cpp.
namespace test0 {
@@ -24,7 +25,9 @@ namespace test0 {
// CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[TMP]])
// CHECK: invoke void @_ZN5test01VC1ERKNS_1AE([[V]]* [[NEWCAST]], [[A]]* dereferenceable({{[0-9]+}}) [[TMP]])
// CHECK: store i1 false, i1* [[CLEANUPACTIVE]]
- // CHECK-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[TMP]])
+
+ // CHECK98-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[TMP]])
+ // CHECK11-NEXT: call void @_ZN5test01AD1Ev([[A]]* [[TMP]])
A y;
try {
A z;
diff --git a/test/Driver/B-opt.c b/test/Driver/B-opt.c
index 318009413b1c2..51273fd7b8269 100644
--- a/test/Driver/B-opt.c
+++ b/test/Driver/B-opt.c
@@ -1,22 +1,22 @@
// Check -B driver option.
//
// RUN: %clang %s -### -o %t.o -target i386-unknown-linux \
-// RUN: -B %S/Inputs/B_opt_tree/dir1 2>&1 \
+// RUN: -B %S/Inputs/B_opt_tree/dir1 -fuse-ld=ld 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-B-OPT-TRIPLE %s
// CHECK-B-OPT-TRIPLE: "{{.*}}/Inputs/B_opt_tree/dir1{{/|\\\\}}i386-unknown-linux-ld"
//
// RUN: %clang %s -### -o %t.o -target i386-unknown-linux \
-// RUN: -B %S/Inputs/B_opt_tree/dir2 2>&1 \
+// RUN: -B %S/Inputs/B_opt_tree/dir2 -fuse-ld=ld 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-B-OPT-DIR %s
// CHECK-B-OPT-DIR: "{{.*}}/Inputs/B_opt_tree/dir2{{/|\\\\}}ld"
//
// RUN: %clang %s -### -o %t.o -target i386-unknown-linux \
-// RUN: -B %S/Inputs/B_opt_tree/dir3/prefix- 2>&1 \
+// RUN: -B %S/Inputs/B_opt_tree/dir3/prefix- -fuse-ld=ld 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-B-OPT-PREFIX %s
// CHECK-B-OPT-PREFIX: "{{.*}}/Inputs/B_opt_tree/dir3{{/|\\\\}}prefix-ld"
//
// RUN: %clang %s -### -o %t.o -target i386-unknown-linux \
// RUN: -B %S/Inputs/B_opt_tree/dir3/prefix- \
-// RUN: -B %S/Inputs/B_opt_tree/dir2 2>&1 \
+// RUN: -B %S/Inputs/B_opt_tree/dir2 2>&1 -fuse-ld=ld \
// RUN: | FileCheck --check-prefix=CHECK-B-OPT-MULT %s
// CHECK-B-OPT-MULT: "{{.*}}/Inputs/B_opt_tree/dir3{{/|\\\\}}prefix-ld"
diff --git a/test/Driver/coverage-ld.c b/test/Driver/coverage-ld.c
index 1eda5f1e95930..206d9abec6fd3 100644
--- a/test/Driver/coverage-ld.c
+++ b/test/Driver/coverage-ld.c
@@ -1,7 +1,7 @@
// Test coverage ld flags.
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target i386-unknown-linux --coverage \
+// RUN: -target i386-unknown-linux --coverage -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LINUX-I386 %s
@@ -10,7 +10,7 @@
// CHECK-LINUX-I386: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-i386.a" {{.*}} "-lc"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux --coverage \
+// RUN: -target x86_64-unknown-linux --coverage -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LINUX-X86-64 %s
@@ -19,7 +19,7 @@
// CHECK-LINUX-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-x86_64.a" {{.*}} "-lc"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-freebsd --coverage \
+// RUN: -target x86_64-unknown-freebsd --coverage -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_freebsd64_tree \
// RUN: | FileCheck --check-prefix=CHECK-FREEBSD-X86-64 %s
@@ -28,7 +28,7 @@
// CHECK-FREEBSD-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}freebsd{{/|\\\\}}libclang_rt.profile-x86_64.a"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target arm-linux-androideabi --coverage \
+// RUN: -target arm-linux-androideabi --coverage -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-ARM %s
diff --git a/test/Driver/cross-linux.c b/test/Driver/cross-linux.c
index 3b1350489294b..a5ea832e77eaa 100644
--- a/test/Driver/cross-linux.c
+++ b/test/Driver/cross-linux.c
@@ -1,4 +1,4 @@
-// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as \
+// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \
// RUN: --gcc-toolchain=%S/Inputs/basic_cross_linux_tree/usr \
// RUN: --target=i386-unknown-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-I386 %s
@@ -6,7 +6,7 @@
// CHECK-I386: "{{.*}}/Inputs/basic_cross_linux_tree/usr/lib/gcc/i386-unknown-linux-gnu/4.6.0/../../../../i386-unknown-linux-gnu/bin{{/|\\\\}}as" "--32"
// CHECK-I386: "{{.*}}/Inputs/basic_cross_linux_tree/usr/lib/gcc/i386-unknown-linux-gnu/4.6.0/../../../../i386-unknown-linux-gnu/bin{{/|\\\\}}ld" {{.*}} "-m" "elf_i386"
//
-// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as \
+// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \
// RUN: --gcc-toolchain=%S/Inputs/basic_cross_linux_tree/usr \
// RUN: --target=x86_64-unknown-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-X86-64 %s
@@ -14,7 +14,7 @@
// CHECK-X86-64: "{{.*}}/Inputs/basic_cross_linux_tree/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin{{/|\\\\}}as" "--64"
// CHECK-X86-64: "{{.*}}/Inputs/basic_cross_linux_tree/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin{{/|\\\\}}ld" {{.*}} "-m" "elf_x86_64"
//
-// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as \
+// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \
// RUN: --gcc-toolchain=%S/Inputs/basic_cross_linux_tree/usr \
// RUN: --target=x86_64-unknown-linux-gnux32 \
// RUN: | FileCheck --check-prefix=CHECK-X32 %s
@@ -22,17 +22,17 @@
// CHECK-X32: "{{.*}}/Inputs/basic_cross_linux_tree/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin{{/|\\\\}}as" "--x32"
// CHECK-X32: "{{.*}}/Inputs/basic_cross_linux_tree/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/bin{{/|\\\\}}ld" {{.*}} "-m" "elf32_x86_64"
//
-// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as \
+// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \
// RUN: --gcc-toolchain=%S/Inputs/basic_cross_linux_tree/usr \
// RUN: --target=x86_64-unknown-linux-gnu -m32 \
// RUN: | FileCheck --check-prefix=CHECK-I386 %s
//
-// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as \
+// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \
// RUN: --gcc-toolchain=%S/Inputs/basic_cross_linux_tree/usr \
// RUN: --target=i386-unknown-linux-gnu -m64 \
// RUN: | FileCheck --check-prefix=CHECK-X86-64 %s
//
-// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as \
+// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \
// RUN: --gcc-toolchain=%S/Inputs/multilib_32bit_linux_tree/usr \
// RUN: --target=i386-unknown-linux \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
@@ -49,7 +49,7 @@
// CHECK-MULTI32-I386: "-L[[sysroot]]/lib"
// CHECK-MULTI32-I386: "-L[[sysroot]]/usr/lib"
//
-// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as \
+// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \
// RUN: --gcc-toolchain=%S/Inputs/multilib_32bit_linux_tree/usr \
// RUN: --target=x86_64-unknown-linux \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
@@ -67,7 +67,7 @@
// CHECK-MULTI32-X86-64: "-L[[sysroot]]/lib"
// CHECK-MULTI32-X86-64: "-L[[sysroot]]/usr/lib"
//
-// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as \
+// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \
// RUN: --gcc-toolchain=%S/Inputs/multilib_64bit_linux_tree/usr \
// RUN: --target=i386-unknown-linux \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
@@ -85,7 +85,7 @@
// CHECK-MULTI64-I386: "-L[[sysroot]]/lib"
// CHECK-MULTI64-I386: "-L[[sysroot]]/usr/lib"
//
-// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as \
+// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \
// RUN: --gcc-toolchain=%S/Inputs/multilib_64bit_linux_tree/usr \
// RUN: --target=x86_64-unknown-linux \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
diff --git a/test/Driver/fuchsia.c b/test/Driver/fuchsia.c
index 229b58828d0f0..75172edf6b274 100644
--- a/test/Driver/fuchsia.c
+++ b/test/Driver/fuchsia.c
@@ -1,5 +1,5 @@
// RUN: %clang %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform 2>&1 | FileCheck %s
+// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 | FileCheck %s
// CHECK: {{.*}}clang{{.*}}" "-cc1"
// CHECK: "-fuse-init-array"
// CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
diff --git a/test/Driver/fuchsia.cpp b/test/Driver/fuchsia.cpp
index 275891d52c306..4490f94d07153 100644
--- a/test/Driver/fuchsia.cpp
+++ b/test/Driver/fuchsia.cpp
@@ -1,5 +1,5 @@
// RUN: %clangxx %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform 2>&1 | FileCheck %s
+// RUN: --sysroot=%S/platform 2>&1 -fuse-ld=ld | FileCheck %s
// CHECK: {{.*}}clang{{.*}}" "-cc1"
// CHECK: "-fuse-init-array"
// CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
diff --git a/test/Driver/fuse-ld.c b/test/Driver/fuse-ld.c
index ca89eb997165a..bd8c9a5386243 100644
--- a/test/Driver/fuse-ld.c
+++ b/test/Driver/fuse-ld.c
@@ -32,7 +32,7 @@
-// RUN: %clang %s -### \
+// RUN: %clang %s -### -fuse-ld=ld \
// RUN: -target arm-linux-androideabi \
// RUN: -B%S/Inputs/basic_android_tree/bin 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-ANDROID-ARM-LD
@@ -50,7 +50,7 @@
// RUN: | FileCheck %s -check-prefix=CHECK-ANDROID-ARM-GOLD
// CHECK-ANDROID-ARM-GOLD: Inputs/basic_android_tree/bin{{/|\\+}}arm-linux-androideabi-ld.gold
-// RUN: %clang %s -### \
+// RUN: %clang %s -### -fuse-ld=ld \
// RUN: -target arm-linux-androideabi \
// RUN: -gcc-toolchain %S/Inputs/basic_android_tree 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-ANDROID-ARM-LD-TC
diff --git a/test/Driver/instrprof-ld.c b/test/Driver/instrprof-ld.c
index 05f65d6146004..ea20105699758 100644
--- a/test/Driver/instrprof-ld.c
+++ b/test/Driver/instrprof-ld.c
@@ -1,7 +1,7 @@
// Test instrumented profiling ld flags.
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target i386-unknown-linux -fprofile-instr-generate \
+// RUN: -target i386-unknown-linux -fprofile-instr-generate -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LINUX-I386 %s
@@ -10,7 +10,7 @@
// CHECK-LINUX-I386: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-i386.a" {{.*}} "-lc"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux -fprofile-instr-generate \
+// RUN: -target x86_64-unknown-linux -fprofile-instr-generate -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LINUX-X86-64 %s
@@ -19,7 +19,7 @@
// CHECK-LINUX-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-x86_64.a" {{.*}} "-lc"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux -fprofile-instr-generate -nostdlib \
+// RUN: -target x86_64-unknown-linux -fprofile-instr-generate -nostdlib -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LINUX-NOSTDLIB-X86-64 %s
@@ -28,7 +28,7 @@
// CHECK-LINUX-NOSTDLIB-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-x86_64.a"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-freebsd -fprofile-instr-generate \
+// RUN: -target x86_64-unknown-freebsd -fprofile-instr-generate -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_freebsd64_tree \
// RUN: | FileCheck --check-prefix=CHECK-FREEBSD-X86-64 %s
@@ -38,7 +38,7 @@
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -shared \
-// RUN: -target i386-unknown-linux -fprofile-instr-generate \
+// RUN: -target i386-unknown-linux -fprofile-instr-generate -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LINUX-I386-SHARED %s
@@ -48,7 +48,7 @@
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -shared \
-// RUN: -target x86_64-unknown-linux -fprofile-instr-generate \
+// RUN: -target x86_64-unknown-linux -fprofile-instr-generate -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LINUX-X86-64-SHARED %s
@@ -58,7 +58,7 @@
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -shared \
-// RUN: -target x86_64-unknown-freebsd -fprofile-instr-generate \
+// RUN: -target x86_64-unknown-freebsd -fprofile-instr-generate -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_freebsd64_tree \
// RUN: | FileCheck --check-prefix=CHECK-FREEBSD-X86-64-SHARED %s
@@ -67,7 +67,7 @@
// CHECK-FREEBSD-X86-64-SHARED: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}freebsd{{/|\\\\}}libclang_rt.profile-x86_64.a"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-apple-darwin14 -fprofile-instr-generate \
+// RUN: -target x86_64-apple-darwin14 -fprofile-instr-generate -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: | FileCheck --check-prefix=CHECK-DARWIN-X86-64 %s
//
@@ -75,7 +75,7 @@
// CHECK-DARWIN-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_osx.a"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-apple-darwin14 -fprofile-instr-generate -nostdlib \
+// RUN: -target x86_64-apple-darwin14 -fprofile-instr-generate -nostdlib -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: | FileCheck --check-prefix=CHECK-DARWIN-NOSTDLIB-X86-64 %s
//
@@ -83,7 +83,7 @@
// CHECK-DARWIN-NOSTDLIB-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_osx.a"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target arm64-apple-ios -fprofile-instr-generate \
+// RUN: -target arm64-apple-ios -fprofile-instr-generate -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: | FileCheck --check-prefix=CHECK-DARWIN-ARM64 %s
//
@@ -91,7 +91,7 @@
// CHECK-DARWIN-ARM64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_ios.a"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target armv7-apple-darwin -mtvos-version-min=8.3 -fprofile-instr-generate \
+// RUN: -target armv7-apple-darwin -mtvos-version-min=8.3 -fprofile-instr-generate -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: | FileCheck --check-prefix=CHECK-TVOS-ARMV7 %s
//
@@ -99,7 +99,7 @@
// CHECK-TVOS-ARMV7: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_tvos.a"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target armv7s-apple-darwin10 -mwatchos-version-min=2.0 -arch armv7k -fprofile-instr-generate \
+// RUN: -target armv7s-apple-darwin10 -mwatchos-version-min=2.0 -arch armv7k -fprofile-instr-generate -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: | FileCheck --check-prefix=CHECK-WATCHOS-ARMV7 %s
//
diff --git a/test/Driver/mips-mti-linux.c b/test/Driver/mips-mti-linux.c
index 4835d798c2690..91a63e2f23cf2 100644
--- a/test/Driver/mips-mti-linux.c
+++ b/test/Driver/mips-mti-linux.c
@@ -8,7 +8,7 @@
// = Big-endian, mips32r2, hard float
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=mips-mti-linux -mips32r2 -mhard-float -rtlib=platform \
+// RUN: --target=mips-mti-linux -mips32r2 -mhard-float -rtlib=platform -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-BE-HF-32R2 %s
//
@@ -26,7 +26,7 @@
// = Little-endian, mips32r2, hard float
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=mips-mti-linux -mips32r2 -EL -mhard-float -rtlib=platform \
+// RUN: --target=mips-mti-linux -mips32r2 -EL -mhard-float -rtlib=platform -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-LE-HF-32R2 %s
//
diff --git a/test/Driver/netbsd.c b/test/Driver/netbsd.c
index 1a87d8e1a6a99..5558a80b98600 100644
--- a/test/Driver/netbsd.c
+++ b/test/Driver/netbsd.c
@@ -23,6 +23,12 @@
// RUN: %clang -no-canonical-prefixes -target aarch64--netbsd7.0.0 \
// RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=AARCH64-7 %s
+// RUN: %clang -no-canonical-prefixes -target aarch64_be--netbsd \
+// RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=AARCH64_BE %s
+// RUN: %clang -no-canonical-prefixes -target aarch64_be--netbsd7.0.0 \
+// RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=AARCH64_BE-7 %s
// RUN: %clang -no-canonical-prefixes -target arm--netbsd-eabi \
// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=ARM %s
@@ -84,6 +90,12 @@
// RUN: %clang -no-canonical-prefixes -target aarch64--netbsd7.0.0 -static \
// RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=S-AARCH64-7 %s
+// RUN: %clang -no-canonical-prefixes -target aarch64_be--netbsd -static \
+// RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=S-AARCH64_BE %s
+// RUN: %clang -no-canonical-prefixes -target aarch64_be--netbsd7.0.0 -static \
+// RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=S-AARCH64_BE-7 %s
// RUN: %clang -no-canonical-prefixes -target arm--netbsd-eabi -static \
// RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=S-ARM %s
@@ -171,6 +183,18 @@
// AARCH64-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc"
// AARCH64-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+// AARCH64_BE: clang{{.*}}" "-cc1" "-triple" "aarch64_be--netbsd"
+// AARCH64_BE: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
+// AARCH64_BE: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
+// AARCH64_BE: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc"
+// AARCH64_BE: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+
+// AARCH64_BE-7: clang{{.*}}" "-cc1" "-triple" "aarch64_be--netbsd7.0.0"
+// AARCH64_BE-7: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
+// AARCH64_BE-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
+// AARCH64_BE-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc"
+// AARCH64_BE-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+
// ARM: clang{{.*}}" "-cc1" "-triple" "armv5e--netbsd-eabi"
// ARM: as{{.*}}" "-mcpu=arm926ej-s" "-o"
// ARM: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
@@ -311,6 +335,18 @@
// S-AARCH64-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc"
// S-AARCH64-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+// S-AARCH64_BE: clang{{.*}}" "-cc1" "-triple" "aarch64_be--netbsd"
+// S-AARCH64_BE: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
+// S-AARCH64_BE: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
+// S-AARCH64_BE: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc"
+// S-AARCH64_BE: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+
+// S-AARCH64_BE-7: clang{{.*}}" "-cc1" "-triple" "aarch64_be--netbsd7.0.0"
+// S-AARCH64_BE-7: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
+// S-AARCH64_BE-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
+// S-AARCH64_BE-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc"
+// S-AARCH64_BE-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+
// S-ARM: clang{{.*}}" "-cc1" "-triple" "armv5e--netbsd-eabi"
// S-ARM: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
// S-ARM: "-m" "armelf_nbsd_eabi"
diff --git a/test/Driver/netbsd.cpp b/test/Driver/netbsd.cpp
index 104d03eba1911..e9b1759831b28 100644
--- a/test/Driver/netbsd.cpp
+++ b/test/Driver/netbsd.cpp
@@ -19,6 +19,12 @@
// RUN: %clangxx -no-canonical-prefixes -target aarch64--netbsd7.0.0 \
// RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=AARCH64-7 %s
+// RUN: %clangxx -no-canonical-prefixes -target aarch64_be--netbsd \
+// RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=AARCH64_BE %s
+// RUN: %clangxx -no-canonical-prefixes -target aarch64_be--netbsd7.0.0 \
+// RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=AARCH64_BE-7 %s
// RUN: %clangxx -no-canonical-prefixes -target sparc--netbsd \
// RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=SPARC %s
@@ -65,6 +71,12 @@
// RUN: %clangxx -no-canonical-prefixes -target aarch64--netbsd7.0.0 -static \
// RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=S-AARCH64-7 %s
+// RUN: %clangxx -no-canonical-prefixes -target aarch64_be--netbsd -static \
+// RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=S-AARCH64_BE %s
+// RUN: %clangxx -no-canonical-prefixes -target aarch64_be--netbsd7.0.0 -static \
+// RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=S-AARCH64_BE-7 %s
// RUN: %clangxx -no-canonical-prefixes -target sparc--netbsd -static \
// RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=S-SPARC %s
@@ -136,6 +148,20 @@
// AARCH64-7: "-lm" "-lc"
// AARCH64-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+// AARCH64_BE: clang{{.*}}" "-cc1" "-triple" "aarch64_be--netbsd"
+// AARCH64_BE: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
+// AARCH64_BE: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
+// AARCH64_BE: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
+// AARCH64_BE: "-lm" "-lc"
+// AARCH64_BE: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+
+// AARCH64_BE-7: clang{{.*}}" "-cc1" "-triple" "aarch64_be--netbsd7.0.0"
+// AARCH64_BE-7: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
+// AARCH64_BE-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
+// AARCH64_BE-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
+// AARCH64_BE-7: "-lm" "-lc"
+// AARCH64_BE-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+
// SPARC: clang{{.*}}" "-cc1" "-triple" "sparc--netbsd"
// SPARC: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
// SPARC: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
@@ -241,6 +267,20 @@
// S-AARCH64-7: "-lm" "-lc"
// S-AARCH64-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+// S-AARCH64_BE: clang{{.*}}" "-cc1" "-triple" "aarch64_be--netbsd"
+// S-AARCH64_BE: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
+// S-AARCH64_BE: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
+// S-AARCH64_BE: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
+// S-AARCH64_BE: "-lm" "-lc"
+// S-AARCH64_BE: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+
+// S-AARCH64_BE-7: clang{{.*}}" "-cc1" "-triple" "aarch64_be--netbsd7.0.0"
+// S-AARCH64_BE-7: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
+// S-AARCH64_BE-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
+// S-AARCH64_BE-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
+// S-AARCH64_BE-7: "-lm" "-lc"
+// S-AARCH64_BE-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
+
// S-SPARC: clang{{.*}}" "-cc1" "-triple" "sparc--netbsd"
// S-SPARC: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
// S-SPARC: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
diff --git a/test/Driver/nostdlib.c b/test/Driver/nostdlib.c
index 7269312acba99..a9ef665c57446 100644
--- a/test/Driver/nostdlib.c
+++ b/test/Driver/nostdlib.c
@@ -13,12 +13,12 @@
// In the presence of -nostdlib, the standard libraries should not be
// passed down to link line
// RUN: %clang -no-canonical-prefixes %s -### -Wno-liblto -o %t.o 2>&1 \
-// RUN: -target i686-pc-linux-gnu -nostdlib --rtlib=compiler-rt \
+// RUN: -target i686-pc-linux-gnu -nostdlib --rtlib=compiler-rt -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir -lclang_rt.builtins-i686 \
// RUN: | FileCheck --check-prefix=CHECK-LINUX-NOSTDLIB %s
//
// RUN: %clang -no-canonical-prefixes %s -### -Wno-liblto -o %t.o 2>&1 \
-// RUN: -target i686-pc-linux-gnu --rtlib=compiler-rt -nostdlib \
+// RUN: -target i686-pc-linux-gnu --rtlib=compiler-rt -nostdlib -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir -lclang_rt.builtins-i686 \
// RUN: | FileCheck --check-prefix=CHECK-LINUX-NOSTDLIB %s
//
diff --git a/test/Driver/prefixed-tools.c b/test/Driver/prefixed-tools.c
index cdd59dae133d7..63f7f29ae9635 100644
--- a/test/Driver/prefixed-tools.c
+++ b/test/Driver/prefixed-tools.c
@@ -1,8 +1,8 @@
-// RUN: %clang -### -B%S/Inputs/prefixed_tools_tree -o %t.o -no-integrated-as \
+// RUN: %clang -### -B%S/Inputs/prefixed_tools_tree -o %t.o -no-integrated-as -fuse-ld=ld \
// RUN: -target x86_64--linux %s 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK-M64 %s
-// RUN: %clang -### -B%S/Inputs/prefixed_tools_tree -o %t.o -no-integrated-as \
+// RUN: %clang -### -B%S/Inputs/prefixed_tools_tree -o %t.o -no-integrated-as -fuse-ld=ld \
// RUN: -m32 -target x86_64--linux %s 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK-M32 %s
diff --git a/test/Driver/sanitizer-ld.c b/test/Driver/sanitizer-ld.c
index 91798b91b343c..c98ce8a0c4c75 100644
--- a/test/Driver/sanitizer-ld.c
+++ b/test/Driver/sanitizer-ld.c
@@ -1,7 +1,7 @@
// Test sanitizers ld flags.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target i386-unknown-linux -fsanitize=address \
+// RUN: -target i386-unknown-linux -fuse-ld=ld -fsanitize=address \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX %s
@@ -17,7 +17,7 @@
// CHECK-ASAN-LINUX: "-ldl"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target i386-unknown-linux -fsanitize=address -shared-libasan \
+// RUN: -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libasan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX %s
@@ -34,7 +34,7 @@
// CHECK-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.so -shared 2>&1 \
-// RUN: -target i386-unknown-linux -fsanitize=address -shared-libasan \
+// RUN: -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libasan \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-DSO-SHARED-ASAN-LINUX %s
@@ -51,7 +51,7 @@
// CHECK-DSO-SHARED-ASAN-LINUX-NOT: "--dynamic-list"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target i386-unknown-freebsd -fsanitize=address \
+// RUN: -target i386-unknown-freebsd -fuse-ld=ld -fsanitize=address \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_freebsd_tree \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD %s
@@ -67,7 +67,7 @@
// CHECK-ASAN-FREEBSD: "-lrt"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target i386-unknown-freebsd -fsanitize=address \
+// RUN: -target i386-unknown-freebsd -fuse-ld=ld -fsanitize=address \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_freebsd_tree \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-FREEBSD-LDL %s
@@ -76,7 +76,7 @@
// CHECK-ASAN-FREEBSD-LDL-NOT: "-ldl"
// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target i386-unknown-linux -stdlib=platform -fsanitize=address \
+// RUN: -target i386-unknown-linux -fuse-ld=ld -stdlib=platform -fsanitize=address \
// RUN: -resource-dir=%S/Inputs/empty_resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX %s
@@ -93,7 +93,7 @@
// CHECK-ASAN-LINUX-CXX: "-ldl"
// RUN: %clang -no-canonical-prefixes %s -### -o /dev/null -fsanitize=address \
-// RUN: -target i386-unknown-linux -stdlib=platform \
+// RUN: -target i386-unknown-linux -fuse-ld=ld -stdlib=platform \
// RUN: --sysroot=%S/Inputs/basic_linux_tree -lstdc++ -static 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX-STATIC %s
//
@@ -103,7 +103,7 @@
// CHECK-ASAN-LINUX-CXX-STATIC: stdc++
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target arm-linux-gnueabi -fsanitize=address \
+// RUN: -target arm-linux-gnueabi -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARM %s
//
@@ -112,7 +112,7 @@
// CHECK-ASAN-ARM: libclang_rt.asan-arm.a"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target armv7l-linux-gnueabi -fsanitize=address \
+// RUN: -target armv7l-linux-gnueabi -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ARMv7 %s
//
@@ -121,7 +121,7 @@
// CHECK-ASAN-ARMv7: libclang_rt.asan-arm.a"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target arm-linux-androideabi -fsanitize=address \
+// RUN: -target arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s
//
@@ -141,7 +141,7 @@
// CHECK-ASAN-ANDROID-SHARED-LIBASAN-NOT: argument unused during compilation: '-shared-libasan'
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target arm-linux-androideabi -fsanitize=address \
+// RUN: -target arm-linux-androideabi -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -shared \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s
@@ -152,7 +152,7 @@
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lpthread"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target sparcel-myriad-rtems-elf -fsanitize=address \
+// RUN: -target sparcel-myriad-rtems-elf -fuse-ld=ld -fsanitize=address \
// RUN: --sysroot=%S/Inputs/basic_myriad_tree \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-MYRIAD %s
//
@@ -161,7 +161,7 @@
// CHECK-ASAN-MYRIAD: libclang_rt.asan-sparcel.a"
// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux -stdlib=platform -lstdc++ \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ \
// RUN: -fsanitize=thread \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
@@ -180,7 +180,7 @@
// CHECK-TSAN-LINUX-CXX: "-ldl"
// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux -stdlib=platform -lstdc++ \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ \
// RUN: -fsanitize=memory \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
@@ -199,7 +199,7 @@
// CHECK-MSAN-LINUX-CXX: "-ldl"
// RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
-// RUN: -target i386-unknown-linux \
+// RUN: -target i386-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s
// CHECK-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
@@ -220,7 +220,7 @@
// CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++"
// RUN: %clangxx -fsanitize=undefined %s -### -o %t.o 2>&1 \
-// RUN: -target i386-unknown-linux -stdlib=platform \
+// RUN: -target i386-unknown-linux -fuse-ld=ld -stdlib=platform \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-CXX %s
@@ -235,7 +235,7 @@
// CHECK-UBSAN-LINUX-CXX: "-lpthread"
// RUN: %clang -fsanitize=address,undefined %s -### -o %t.o 2>&1 \
-// RUN: -target i386-unknown-linux \
+// RUN: -target i386-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX %s
// CHECK-ASAN-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}"
@@ -245,7 +245,7 @@
// CHECK-ASAN-UBSAN-LINUX: "-lpthread"
// RUN: %clangxx -fsanitize=address,undefined %s -### -o %t.o 2>&1 \
-// RUN: -target i386-unknown-linux -stdlib=platform \
+// RUN: -target i386-unknown-linux -fuse-ld=ld -stdlib=platform \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX-CXX %s
// CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
@@ -256,7 +256,7 @@
// CHECK-ASAN-UBSAN-LINUX-CXX: "-lpthread"
// RUN: %clangxx -fsanitize=memory,undefined %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-MSAN-UBSAN-LINUX-CXX %s
// CHECK-MSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
@@ -264,7 +264,7 @@
// CHECK-MSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
// RUN: %clangxx -fsanitize=thread,undefined %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-TSAN-UBSAN-LINUX-CXX %s
// CHECK-TSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
@@ -272,7 +272,7 @@
// CHECK-TSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan
// RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
-// RUN: -target i386-unknown-linux \
+// RUN: -target i386-unknown-linux -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: -shared \
@@ -283,7 +283,7 @@
// CHECK-UBSAN-LINUX-SHARED-NOT: libclang_rt.ubsan
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux -fsanitize=leak \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LSAN-LINUX %s
//
@@ -295,7 +295,7 @@
// CHECK-LSAN-LINUX: "-ldl"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux -fsanitize=leak -fsanitize-coverage=func \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak -fsanitize-coverage=func \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LSAN-COV-LINUX %s
//
@@ -308,7 +308,7 @@
// CHECK-LSAN-COV-LINUX: "-ldl"
// RUN: %clang -fsanitize=leak,address %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LSAN-ASAN-LINUX %s
// CHECK-LSAN-ASAN-LINUX: "{{.*}}ld{{(.exe)?}}"
@@ -317,7 +317,7 @@
// CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan
// RUN: %clang -fsanitize=address -fsanitize-coverage=func %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-COV-LINUX %s
// CHECK-ASAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
@@ -327,7 +327,7 @@
// CHECK-ASAN-COV-LINUX: "-lpthread"
// RUN: %clang -fsanitize=memory -fsanitize-coverage=func %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-MSAN-COV-LINUX %s
// CHECK-MSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
@@ -337,7 +337,7 @@
// CHECK-MSAN-COV-LINUX: "-lpthread"
// RUN: %clang -fsanitize=dataflow -fsanitize-coverage=func %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-DFSAN-COV-LINUX %s
// CHECK-DFSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
@@ -347,7 +347,7 @@
// CHECK-DFSAN-COV-LINUX: "-lpthread"
// RUN: %clang -fsanitize=undefined -fsanitize-coverage=func %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-COV-LINUX %s
// CHECK-UBSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
@@ -356,7 +356,7 @@
// CHECK-UBSAN-COV-LINUX: "-lpthread"
// RUN: %clang -fsanitize-coverage=func %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-COV-LINUX %s
// CHECK-COV-LINUX: "{{.*}}ld{{(.exe)?}}"
@@ -366,7 +366,7 @@
// CFI by itself does not link runtime libraries.
// RUN: %clang -fsanitize=cfi %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux -rtlib=platform \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld -rtlib=platform \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-CFI-LINUX %s
// CHECK-CFI-LINUX: "{{.*}}ld{{(.exe)?}}"
@@ -375,7 +375,7 @@
// CFI with diagnostics links the UBSan runtime.
// RUN: %clang -fsanitize=cfi -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
// RUN: %s -### -o %t.o 2>&1\
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-CFI-DIAG-LINUX %s
// CHECK-CFI-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
@@ -383,7 +383,7 @@
// Cross-DSO CFI links the CFI runtime.
// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX %s
// CHECK-CFI-CROSS-DSO-LINUX: "{{.*}}ld{{(.exe)?}}"
@@ -393,7 +393,7 @@
// Cross-DSO CFI with diagnostics links just the CFI runtime.
// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso %s -### -o %t.o 2>&1 \
// RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX %s
// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
@@ -402,7 +402,7 @@
// RUN: %clangxx -fsanitize=address %s -### -o %t.o 2>&1 \
// RUN: -mmacosx-version-min=10.6 \
-// RUN: -target x86_64-apple-darwin13.4.0 -stdlib=platform \
+// RUN: -target x86_64-apple-darwin13.4.0 -fuse-ld=ld -stdlib=platform \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-DARWIN106-CXX %s
// CHECK-ASAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}"
@@ -410,7 +410,7 @@
// CHECK-ASAN-DARWIN106-CXX-NOT: -lc++abi
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux -fsanitize=safe-stack \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=safe-stack \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-LINUX %s
//
@@ -421,7 +421,7 @@
// CHECK-SAFESTACK-LINUX: "-ldl"
// RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-LINUX %s
// CHECK-CFI-STATS-LINUX: "{{.*}}ld{{(.exe)?}}"
@@ -430,7 +430,7 @@
// CHECK-CFI-STATS-LINUX: "{{[^"]*}}libclang_rt.stats-x86_64.a"
// RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-apple-darwin \
+// RUN: -target x86_64-apple-darwin -fuse-ld=ld \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-DARWIN %s
// CHECK-CFI-STATS-DARWIN: "{{.*}}ld{{(.exe)?}}"
@@ -454,7 +454,7 @@
// CHECK-CFI-STATS-WIN32: "--linker-option=/include:___sanitizer_stats_register"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target arm-linux-androideabi -fsanitize=safe-stack \
+// RUN: -target arm-linux-androideabi -fuse-ld=ld -fsanitize=safe-stack \
// RUN: --sysroot=%S/Inputs/basic_android_tree \
// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s
//
@@ -462,7 +462,7 @@
// CHECK-SAFESTACK-ANDROID-ARM-NOT: libclang_rt.safestack
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o -shared 2>&1 \
-// RUN: -target arm-linux-androideabi -fsanitize=safe-stack \
+// RUN: -target arm-linux-androideabi -fuse-ld=ld -fsanitize=safe-stack \
// RUN: --sysroot=%S/Inputs/basic_android_tree \
// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-SHARED-ANDROID-ARM %s
//
@@ -470,7 +470,7 @@
// CHECK-SAFESTACK-SHARED-ANDROID-ARM-NOT: libclang_rt.safestack
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target aarch64-linux-android -fsanitize=safe-stack \
+// RUN: -target aarch64-linux-android -fuse-ld=ld -fsanitize=safe-stack \
// RUN: --sysroot=%S/Inputs/basic_android_tree \
// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-AARCH64 %s
//
@@ -478,7 +478,7 @@
// CHECK-SAFESTACK-ANDROID-AARCH64-NOT: libclang_rt.safestack
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target arm-linux-androideabi -fsanitize=cfi \
+// RUN: -target arm-linux-androideabi -fuse-ld=ld -fsanitize=cfi \
// RUN: --sysroot=%S/Inputs/basic_android_tree \
// RUN: | FileCheck --check-prefix=CHECK-CFI-ANDROID %s
//
@@ -487,7 +487,7 @@
// CHECK-CFI-ANDROID-NOT: __cfi_check
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target arm-linux-androideabi -fsanitize=cfi \
+// RUN: -target arm-linux-androideabi -fuse-ld=ld -fsanitize=cfi \
// RUN: -fsanitize-cfi-cross-dso \
// RUN: --sysroot=%S/Inputs/basic_android_tree \
// RUN: | FileCheck --check-prefix=CHECK-CROSSDSO-CFI-ANDROID %s
@@ -498,31 +498,31 @@
// CHECK-CROSSDSO-CFI-ANDROID-NOT: libclang_rt.cfi
// RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-scei-ps4 \
+// RUN: -target x86_64-scei-ps4 -fuse-ld=ld \
// RUN: -shared \
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-PS4 %s
// CHECK-UBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
// CHECK-UBSAN-PS4: -lSceDbgUBSanitizer_stub_weak
// RUN: %clang -fsanitize=address %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-scei-ps4 \
+// RUN: -target x86_64-scei-ps4 -fuse-ld=ld \
// RUN: -shared \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-PS4 %s
// CHECK-ASAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
// CHECK-ASAN-PS4: -lSceDbgAddressSanitizer_stub_weak
// RUN: %clang -fsanitize=address,undefined %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-scei-ps4 \
+// RUN: -target x86_64-scei-ps4 -fuse-ld=ld \
// RUN: -shared \
// RUN: | FileCheck --check-prefix=CHECK-AUBSAN-PS4 %s
// CHECK-AUBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}"
// CHECK-AUBSAN-PS4: -lSceDbgAddressSanitizer_stub_weak
// RUN: %clang -fsanitize=efficiency-cache-frag %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: | FileCheck --check-prefix=CHECK-ESAN-LINUX %s
// RUN: %clang -fsanitize=efficiency-working-set %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-unknown-linux \
+// RUN: -target x86_64-unknown-linux -fuse-ld=ld \
// RUN: | FileCheck --check-prefix=CHECK-ESAN-LINUX %s
//
// CHECK-ESAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
diff --git a/test/Driver/windows-cross.c b/test/Driver/windows-cross.c
index 84ef2df75d6f7..5a2fe52b099e1 100644
--- a/test/Driver/windows-cross.c
+++ b/test/Driver/windows-cross.c
@@ -1,34 +1,34 @@
-// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -stdlib=libstdc++ -rtlib=platform -o /dev/null %s 2>&1 \
+// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -stdlib=libstdc++ -rtlib=platform -o /dev/null %s 2>&1 \
// RUN: | FileCheck %s --check-prefix CHECK-BASIC
// CHECK-BASIC: armv7-windows-itanium-ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/crtbegin.obj" "-L{{.*}}/Inputs/Windows/ARM/8.1/usr/lib" "-L{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/gcc" "{{.*}}.o" "-lmsvcrt" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
-// RUN: %clang -### -target armv7-windows-itanium --sysroot %s/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -rtlib=compiler-rt -stdlib=libstdc++ -o /dev/null %s 2>&1 \
+// RUN: %clang -### -target armv7-windows-itanium --sysroot %s/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -rtlib=compiler-rt -stdlib=libstdc++ -o /dev/null %s 2>&1 \
// RUN: | FileCheck %s --check-prefix CHECK-RTLIB
// CHECK-RTLIB: armv7-windows-itanium-ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/crtbegin.obj" "-L{{.*}}/Inputs/Windows/ARM/8.1/usr/lib" "-L{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/gcc" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins-arm.lib"
-// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -rtlib=compiler-rt -stdlib=libc++ -o /dev/null %s 2>&1 \
+// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -rtlib=compiler-rt -stdlib=libc++ -o /dev/null %s 2>&1 \
// RUN: | FileCheck %s --check-prefix CHECK-C-LIBCXX
// CHECK-C-LIBCXX: armv7-windows-itanium-ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/crtbegin.obj" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins-arm.lib"
-// RUN: %clangxx -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -rtlib=compiler-rt -stdlib=libc++ -o /dev/null %s 2>&1 \
+// RUN: %clangxx -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -rtlib=compiler-rt -stdlib=libc++ -o /dev/null %s 2>&1 \
// RUN: | FileCheck %s --check-prefix CHECK-LIBCXX
// CHECK-LIBCXX: armv7-windows-itanium-ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-Bdynamic" "--entry" "mainCRTStartup" "--allow-multiple-definition" "-o" "{{[^"]*}}" "{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/crtbegin.obj" "{{.*}}.o" "-lc++" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins-arm.lib"
-// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -shared -rtlib=compiler-rt -stdlib=libc++ -o shared.dll %s 2>&1 \
+// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -shared -rtlib=compiler-rt -stdlib=libc++ -o shared.dll %s 2>&1 \
// RUN: | FileCheck %s --check-prefix CHECK-SHARED
// CHECK-SHARED: armv7-windows-itanium-ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bdynamic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}/Inputs/Windows/ARM/8.1/usr/lib/crtbeginS.obj" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins-arm.lib"
-// RUN: %clang -### -target armv7-windows-itanium --sysroot %s/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -shared -rtlib=compiler-rt -stdlib=libc++ -nostartfiles -o shared.dll %s 2>&1 \
+// RUN: %clang -### -target armv7-windows-itanium --sysroot %s/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -shared -rtlib=compiler-rt -stdlib=libc++ -nostartfiles -o shared.dll %s 2>&1 \
// RUN: | FileCheck %s --check-prefix CHECK-NOSTARTFILES
// CHECK-NOSTARTFILES: armv7-windows-itanium-ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bdynamic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o" "-lmsvcrt" "{{.*[\\/]}}clang_rt.builtins-arm.lib"
-// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -shared -rtlib=compiler-rt -stdlib=libc++ -nostartfiles -nodefaultlibs -o shared.dll %s 2>&1 \
+// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=ld -shared -rtlib=compiler-rt -stdlib=libc++ -nostartfiles -nodefaultlibs -o shared.dll %s 2>&1 \
// RUN: | FileCheck %s --check-prefix CHECK-STANDALONE
// CHECK-STANDALONE: armv7-windows-itanium-ld" "--sysroot={{.*}}/Inputs/Windows/ARM/8.1" "-m" "thumb2pe" "-shared" "-Bdynamic" "--enable-auto-image-base" "--entry" "_DllMainCRTStartup" "--allow-multiple-definition" "-o" "shared.dll" "--out-implib" "shared.lib" "{{.*}}.o"
diff --git a/test/Index/Core/index-source.cpp b/test/Index/Core/index-source.cpp
index 7db5d531f43dc..0e898d8c83ab6 100644
--- a/test/Index/Core/index-source.cpp
+++ b/test/Index/Core/index-source.cpp
@@ -1,5 +1,16 @@
// RUN: c-index-test core -print-source-symbols -- %s -std=c++14 -target x86_64-apple-macosx10.7 | FileCheck %s
+// CHECK: [[@LINE+1]]:7 | class/C++ | Cls | c:@S@Cls | <no-cgname> | Def | rel: 0
+class Cls {
+ // CHECK: [[@LINE+2]]:3 | constructor/C++ | Cls | c:@S@Cls@F@Cls#I# | __ZN3ClsC1Ei | Decl,RelChild | rel: 1
+ // CHECK-NEXT: RelChild | Cls | c:@S@Cls
+ Cls(int x);
+ // CHECK: [[@LINE+1]]:3 | constructor/cxx-copy-ctor/C++ | Cls | c:@S@Cls@F@Cls#&1$@S@Cls# | __ZN3ClsC1ERKS_ | Decl,RelChild | rel: 1
+ Cls(const Cls &);
+ // CHECK: [[@LINE+1]]:3 | constructor/cxx-move-ctor/C++ | Cls | c:@S@Cls@F@Cls#&&$@S@Cls# | __ZN3ClsC1EOS_ | Decl,RelChild | rel: 1
+ Cls(Cls &&);
+};
+
template <typename TemplArg>
class TemplCls {
// CHECK: [[@LINE-1]]:7 | class(Gen)/C++ | TemplCls | c:@ST>1#T@TemplCls | <no-cgname> | Def | rel: 0
diff --git a/test/Misc/diag-template-diffing.cpp b/test/Misc/diag-template-diffing.cpp
index 7808398992824..9006fc6f9ac9c 100644
--- a/test/Misc/diag-template-diffing.cpp
+++ b/test/Misc/diag-template-diffing.cpp
@@ -1265,7 +1265,7 @@ void test() {
foo<BoolT<true>>(X);
}
// CHECK-ELIDE-NOTREE: no matching function for call to 'foo'
-// CHECK-ELIDE-NOTREE: candidate function [with T = BoolArgumentBitExtended::BoolT<true>] not viable: no known conversion from 'BoolT<false>' to 'BoolT<true>' for 1st argument
+// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'BoolT<false>' to 'BoolT<true>' for 1st argument
}
namespace DifferentIntegralTypes {
@@ -1401,7 +1401,7 @@ void run() {
f(1, integral_constant<bool, true>{});
}
// CHECK-ELIDE-NOTREE: error: no matching function for call to 'f'
-// CHECK-ELIDE-NOTREE: note: candidate function [with T = int] not viable: no known conversion from 'integral_constant<[...], true>' to 'integral_constant<[...], false>' for 2nd argument
+// CHECK-ELIDE-NOTREE: note: candidate function not viable: no known conversion from 'integral_constant<[...], true>' to 'integral_constant<[...], false>' for 2nd argument
}
namespace ZeroArgs {
@@ -1454,7 +1454,7 @@ void run() {
D<X::X1>(VectorType<X::X2>());
}
// CHECK-ELIDE-NOTREE: error: no matching function for call to 'D'
-// CHECK-ELIDE-NOTREE: note: candidate function [with x = TypeAlias::X::X1] not viable: no known conversion from 'VectorType<X::X2>' to 'const VectorType<(TypeAlias::X)0>' for 1st argument
+// CHECK-ELIDE-NOTREE: note: candidate function not viable: no known conversion from 'VectorType<X::X2>' to 'const VectorType<(TypeAlias::X)0>' for 1st argument
}
namespace TypeAlias2 {
diff --git a/test/Modules/Inputs/pch-with-module-name/A.h b/test/Modules/Inputs/pch-with-module-name/A.h
new file mode 100644
index 0000000000000..a73b3759d4ec8
--- /dev/null
+++ b/test/Modules/Inputs/pch-with-module-name/A.h
@@ -0,0 +1 @@
+// in pch
diff --git a/test/Modules/Inputs/pch-with-module-name/C.h b/test/Modules/Inputs/pch-with-module-name/C.h
new file mode 100644
index 0000000000000..f681dd80974ad
--- /dev/null
+++ b/test/Modules/Inputs/pch-with-module-name/C.h
@@ -0,0 +1 @@
+#include "D.h"
diff --git a/test/Modules/Inputs/pch-with-module-name/C.m b/test/Modules/Inputs/pch-with-module-name/C.m
new file mode 100644
index 0000000000000..90fe1bcc58511
--- /dev/null
+++ b/test/Modules/Inputs/pch-with-module-name/C.m
@@ -0,0 +1 @@
+//empty
diff --git a/test/Modules/Inputs/pch-with-module-name/D.h b/test/Modules/Inputs/pch-with-module-name/D.h
new file mode 100644
index 0000000000000..90fe1bcc58511
--- /dev/null
+++ b/test/Modules/Inputs/pch-with-module-name/D.h
@@ -0,0 +1 @@
+//empty
diff --git a/test/Modules/Inputs/pch-with-module-name/module.modulemap b/test/Modules/Inputs/pch-with-module-name/module.modulemap
new file mode 100644
index 0000000000000..379b0d48d5899
--- /dev/null
+++ b/test/Modules/Inputs/pch-with-module-name/module.modulemap
@@ -0,0 +1,9 @@
+module CloudKit {
+ header "C.h"
+ export *
+}
+
+module Contacts {
+ header "D.h"
+ export *
+}
diff --git a/test/Modules/Inputs/pch-with-module-name/test.h b/test/Modules/Inputs/pch-with-module-name/test.h
new file mode 100644
index 0000000000000..7a13ba4d72d41
--- /dev/null
+++ b/test/Modules/Inputs/pch-with-module-name/test.h
@@ -0,0 +1 @@
+#include "A.h"
diff --git a/test/Modules/pch-with-module-name.m b/test/Modules/pch-with-module-name.m
new file mode 100644
index 0000000000000..c4096308c4f61
--- /dev/null
+++ b/test/Modules/pch-with-module-name.m
@@ -0,0 +1,5 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/pch-with-module-name -emit-pch -o %t-A.pch %S/Inputs/pch-with-module-name/test.h -fmodule-name=Contacts -x objective-c-header
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/pch-with-module-name -include-pch %t-A.pch %s -fsyntax-only -fmodule-name=Contacts -verify
+// expected-no-diagnostics
+#include "C.h"
diff --git a/test/OpenMP/atomic_codegen.cpp b/test/OpenMP/atomic_codegen.cpp
index 536f2cdffafbc..7f62a9bfa6fb9 100644
--- a/test/OpenMP/atomic_codegen.cpp
+++ b/test/OpenMP/atomic_codegen.cpp
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm -std=c++98 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm -std=c++11 %s -o - | FileCheck %s
// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -debug-info-kind=line-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
// expected-no-diagnostics
@@ -21,14 +23,15 @@ void parallel_atomic_ewc() {
// CHECK: [[SCALAR_ADDR:%.+]] = invoke dereferenceable(4) i32* @_ZN2St3getEv(%struct.St* [[TEMP_ST_ADDR]])
// CHECK: [[SCALAR_VAL:%.+]] = load atomic i32, i32* [[SCALAR_ADDR]] monotonic
// CHECK: store i32 [[SCALAR_VAL]], i32* @b
- // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+ // CHECK98: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+ // CHECK11: call void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
#pragma omp atomic read
b = St().get();
// CHECK-DAG: invoke void @_ZN2StC1Ev(%struct.St* [[TEMP_ST_ADDR:%.+]])
// CHECK-DAG: [[SCALAR_ADDR:%.+]] = invoke dereferenceable(4) i32* @_ZN2St3getEv(%struct.St* [[TEMP_ST_ADDR]])
// CHECK-DAG: [[B_VAL:%.+]] = load i32, i32* @b
// CHECK: store atomic i32 [[B_VAL]], i32* [[SCALAR_ADDR]] monotonic
- // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+ // CHECK: {{invoke|call}} void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
#pragma omp atomic write
St().get() = b;
// CHECK: invoke void @_ZN2StC1Ev(%struct.St* [[TEMP_ST_ADDR:%.+]])
@@ -46,7 +49,7 @@ void parallel_atomic_ewc() {
// CHECK: [[COND:%.+]] = extractvalue { i32, i1 } [[RES]], 1
// CHECK: br i1 [[COND]], label %[[OMP_DONE:.+]], label %[[OMP_UPDATE]]
// CHECK: [[OMP_DONE]]
- // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+ // CHECK: {{invoke|call}} void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
#pragma omp atomic
St().get() %= b;
#pragma omp atomic
@@ -67,7 +70,7 @@ void parallel_atomic_ewc() {
// CHECK: br i1 [[COND]], label %[[OMP_DONE:.+]], label %[[OMP_UPDATE]]
// CHECK: [[OMP_DONE]]
// CHECK: store i32 [[NEW_CALC_VAL]], i32* @a,
- // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+ // CHECK: {{invoke|call}} void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
#pragma omp atomic capture
a = St().get() %= b;
}
diff --git a/test/OpenMP/threadprivate_codegen.cpp b/test/OpenMP/threadprivate_codegen.cpp
index d2cbc154cc83f..09f5ed5060ba3 100644
--- a/test/OpenMP/threadprivate_codegen.cpp
+++ b/test/OpenMP/threadprivate_codegen.cpp
@@ -275,7 +275,7 @@ S1 arr_x[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } };
// CHECK: {{.*}}[[ARR_LOOP]]{{.*}}
// CHECK-NEXT: [[ARR_ELEMENTPAST:%.*]] = phi [[S1]]* [ [[ARR_CUR]], {{.*}} ], [ [[ARR_ELEMENT:%.*]], {{.*}} ]
// CHECK-NEXT: [[ARR_ELEMENT:%.*]] = getelementptr inbounds [[S1]], [[S1]]* [[ARR_ELEMENTPAST]], i{{.*}} -1
-// CHECK-NEXT: invoke {{.*}} [[S1_DTOR]]([[S1]]* [[ARR_ELEMENT]])
+// CHECK-NEXT: {{call|invoke}} {{.*}} [[S1_DTOR]]([[S1]]* [[ARR_ELEMENT]])
// CHECK: [[ARR_DONE:%.*]] = icmp eq [[S1]]* [[ARR_ELEMENT]], [[ARR_BEGIN]]
// CHECK-NEXT: br i1 [[ARR_DONE]], label %[[ARR_EXIT:.*]], label %[[ARR_LOOP]]
// CHECK: {{.*}}[[ARR_EXIT]]{{.*}}
diff --git a/test/Sema/diagnose_if.c b/test/Sema/diagnose_if.c
new file mode 100644
index 0000000000000..219e393bc0cc4
--- /dev/null
+++ b/test/Sema/diagnose_if.c
@@ -0,0 +1,152 @@
+// RUN: %clang_cc1 %s -verify -fno-builtin
+
+#define _diagnose_if(...) __attribute__((diagnose_if(__VA_ARGS__)))
+
+void failure() _diagnose_if(); // expected-error{{exactly 3 arguments}}
+void failure() _diagnose_if(0); // expected-error{{exactly 3 arguments}}
+void failure() _diagnose_if(0, ""); // expected-error{{exactly 3 arguments}}
+void failure() _diagnose_if(0, "", "error", 1); // expected-error{{exactly 3 arguments}}
+void failure() _diagnose_if(0, 0, "error"); // expected-error{{requires a string}}
+void failure() _diagnose_if(0, "", "invalid"); // expected-error{{invalid diagnostic type for 'diagnose_if'; use "error" or "warning" instead}}
+void failure() _diagnose_if(0, "", "ERROR"); // expected-error{{invalid diagnostic type}}
+void failure(int a) _diagnose_if(a, "", ""); // expected-error{{invalid diagnostic type}}
+void failure() _diagnose_if(a, "", ""); // expected-error{{undeclared identifier 'a'}}
+
+int globalVar;
+void never_constant() _diagnose_if(globalVar, "", "error"); // expected-error{{'diagnose_if' attribute expression never produces a constant expression}} expected-note{{subexpression not valid}}
+void never_constant() _diagnose_if(globalVar, "", "warning"); // expected-error{{'diagnose_if' attribute expression never produces a constant expression}} expected-note{{subexpression not valid}}
+
+int alwaysok(int q) _diagnose_if(0, "", "error");
+int neverok(int q) _diagnose_if(1, "oh no", "error"); // expected-note 5{{from 'diagnose_if' attribute on 'neverok'}}
+int alwayswarn(int q) _diagnose_if(1, "oh no", "warning"); // expected-note 5{{from 'diagnose_if' attribute}}
+int neverwarn(int q) _diagnose_if(0, "", "warning");
+
+void runConstant() {
+ int m;
+ alwaysok(0);
+ alwaysok(1);
+ alwaysok(m);
+
+ {
+ int (*pok)(int) = alwaysok;
+ pok = &alwaysok;
+ }
+
+ neverok(0); // expected-error{{oh no}}
+ neverok(1); // expected-error{{oh no}}
+ neverok(m); // expected-error{{oh no}}
+ {
+ int (*pok)(int) = neverok; // expected-error{{oh no}}
+ pok = &neverok; // expected-error{{oh no}}
+ }
+
+ alwayswarn(0); // expected-warning{{oh no}}
+ alwayswarn(1); // expected-warning{{oh no}}
+ alwayswarn(m); // expected-warning{{oh no}}
+ {
+ int (*pok)(int) = alwayswarn; // expected-warning{{oh no}}
+ pok = &alwayswarn; // expected-warning{{oh no}}
+ }
+
+ neverwarn(0);
+ neverwarn(1);
+ neverwarn(m);
+ {
+ int (*pok)(int) = neverwarn;
+ pok = &neverwarn;
+ }
+}
+
+int abs(int q) _diagnose_if(q >= 0, "redundant abs call", "error"); //expected-note{{from 'diagnose_if'}}
+void runVariable() {
+ int m;
+ abs(-1);
+ abs(1); // expected-error{{redundant abs call}}
+ abs(m);
+
+ int (*pabs)(int) = abs;
+ pabs = &abs;
+}
+
+#define _overloadable __attribute__((overloadable))
+
+int ovl1(const char *n) _overloadable _diagnose_if(n, "oh no", "error"); // expected-note{{oh no}}
+int ovl1(void *m) _overloadable; // expected-note{{candidate function}}
+
+int ovl2(const char *n) _overloadable _diagnose_if(n, "oh no", "error"); // expected-note{{candidate function}}
+int ovl2(char *m) _overloadable; // expected-note{{candidate function}}
+void overloadsYay() {
+ ovl1((void *)0);
+ ovl1(""); // expected-error{{call to unavailable function}}
+
+ ovl2((void *)0); // expected-error{{ambiguous}}
+}
+
+void errorWarnDiagnose1() _diagnose_if(1, "oh no", "error") // expected-note{{from 'diagnose_if'}}
+ _diagnose_if(1, "nop", "warning");
+void errorWarnDiagnose2() _diagnose_if(1, "oh no", "error") // expected-note{{from 'diagnose_if'}}
+ _diagnose_if(1, "nop", "error");
+void errorWarnDiagnose3() _diagnose_if(1, "nop", "warning")
+ _diagnose_if(1, "oh no", "error"); // expected-note{{from 'diagnose_if'}}
+
+void errorWarnDiagnoseArg1(int a) _diagnose_if(a == 1, "oh no", "error") // expected-note{{from 'diagnose_if'}}
+ _diagnose_if(a == 1, "nop", "warning");
+void errorWarnDiagnoseArg2(int a) _diagnose_if(a == 1, "oh no", "error") // expected-note{{from 'diagnose_if'}}
+ _diagnose_if(a == 1, "nop", "error");
+void errorWarnDiagnoseArg3(int a) _diagnose_if(a == 1, "nop", "warning")
+ _diagnose_if(a == 1, "oh no", "error"); // expected-note{{from 'diagnose_if'}}
+
+void runErrorWarnDiagnose() {
+ errorWarnDiagnose1(); // expected-error{{oh no}}
+ errorWarnDiagnose2(); // expected-error{{oh no}}
+ errorWarnDiagnose3(); // expected-error{{oh no}}
+
+ errorWarnDiagnoseArg1(1); // expected-error{{oh no}}
+ errorWarnDiagnoseArg2(1); // expected-error{{oh no}}
+ errorWarnDiagnoseArg3(1); // expected-error{{oh no}}
+}
+
+void warnWarnDiagnose() _diagnose_if(1, "oh no!", "warning") _diagnose_if(1, "foo", "warning"); // expected-note 2{{from 'diagnose_if'}}
+void runWarnWarnDiagnose() {
+ warnWarnDiagnose(); // expected-warning{{oh no!}} expected-warning{{foo}}
+}
+
+void declsStackErr1(int a) _diagnose_if(a & 1, "decl1", "error"); // expected-note 2{{from 'diagnose_if'}}
+void declsStackErr1(int a) _diagnose_if(a & 2, "decl2", "error"); // expected-note{{from 'diagnose_if'}}
+void declsStackErr2();
+void declsStackErr2() _diagnose_if(1, "complaint", "error"); // expected-note{{from 'diagnose_if'}}
+void declsStackErr3() _diagnose_if(1, "complaint", "error"); // expected-note{{from 'diagnose_if'}}
+void declsStackErr3();
+void runDeclsStackErr() {
+ declsStackErr1(0);
+ declsStackErr1(1); // expected-error{{decl1}}
+ declsStackErr1(2); // expected-error{{decl2}}
+ declsStackErr1(3); // expected-error{{decl1}}
+ declsStackErr2(); // expected-error{{complaint}}
+ declsStackErr3(); // expected-error{{complaint}}
+}
+
+void declsStackWarn1(int a) _diagnose_if(a & 1, "decl1", "warning"); // expected-note 2{{from 'diagnose_if'}}
+void declsStackWarn1(int a) _diagnose_if(a & 2, "decl2", "warning"); // expected-note 2{{from 'diagnose_if'}}
+void declsStackWarn2();
+void declsStackWarn2() _diagnose_if(1, "complaint", "warning"); // expected-note{{from 'diagnose_if'}}
+void declsStackWarn3() _diagnose_if(1, "complaint", "warning"); // expected-note{{from 'diagnose_if'}}
+void declsStackWarn3();
+void runDeclsStackWarn() {
+ declsStackWarn1(0);
+ declsStackWarn1(1); // expected-warning{{decl1}}
+ declsStackWarn1(2); // expected-warning{{decl2}}
+ declsStackWarn1(3); // expected-warning{{decl1}} expected-warning{{decl2}}
+ declsStackWarn2(); // expected-warning{{complaint}}
+ declsStackWarn3(); // expected-warning{{complaint}}
+}
+
+void noMsg(int n) _diagnose_if(n, "", "warning"); // expected-note{{from 'diagnose_if'}}
+void runNoMsg() {
+ noMsg(1); // expected-warning{{<no message provided>}}
+}
+
+void alwaysWarnWithArg(int a) _diagnose_if(1 || a, "alwaysWarn", "warning"); // expected-note{{from 'diagnose_if'}}
+void runAlwaysWarnWithArg(int a) {
+ alwaysWarnWithArg(a); // expected-warning{{alwaysWarn}}
+}
diff --git a/test/SemaCXX/PR10177.cpp b/test/SemaCXX/PR10177.cpp
index 9286e29351679..59630be508859 100644
--- a/test/SemaCXX/PR10177.cpp
+++ b/test/SemaCXX/PR10177.cpp
@@ -24,6 +24,13 @@ void f() {
(void)class_ref<int, int&, U<2>::a>(); // expected-note {{here}}
};
+template<typename T>
+void not_instantiated() {
+ // These cases (arguably) do not require instantiation of U<i>::a.
+ (void)alias_ref<int, int&, U<3>::a>();
+ (void)func_ref<int, int&, U<4>::a>();
+ (void)class_ref<int, int&, U<5>::a>();
+};
template<int N>
void fi() {
@@ -33,7 +40,7 @@ void fi() {
};
int main() {
- f<int>(); // NOTE: Non-dependent name uses are type-checked at template definition time.
+ f<int>(); // expected-note 3{{here}}
fi<10>(); // expected-note 3{{here}}
}
diff --git a/test/SemaCXX/attr-mode-tmpl.cpp b/test/SemaCXX/attr-mode-tmpl.cpp
index 4e1489a8a5bde..d83bb39890508 100644
--- a/test/SemaCXX/attr-mode-tmpl.cpp
+++ b/test/SemaCXX/attr-mode-tmpl.cpp
@@ -45,7 +45,7 @@ void CheckMachineMode() {
// Check attributes on function parameters.
template <class T1, class T2>
-void CheckParameters(T1 __attribute__((mode(SI))) paramSI, // expected-note2{{ignored: substitution failure}}
+void CheckParameters(T1 __attribute__((mode(SI))) paramSI, // expected-note{{ignored: substitution failure}} expected-note-re{{not viable: no known conversion from '{{.*}}' (vector of 4 '{{.*}}' values) to 'EnumType' for 2nd argument}}
T1 __attribute__((mode(V4DI))) paramV4DI, // expected-warning{{deprecated}}
T2 __attribute__((mode(SF))) paramSF,
T2 __attribute__((mode(V4DF))) paramV4DF) { // expected-warning{{deprecated}}
diff --git a/test/SemaCXX/attr-noreturn.cpp b/test/SemaCXX/attr-noreturn.cpp
index a8e71db737027..6edc86c43a7d2 100644
--- a/test/SemaCXX/attr-noreturn.cpp
+++ b/test/SemaCXX/attr-noreturn.cpp
@@ -244,11 +244,11 @@ namespace PR15291 {
template <typename T>
void qux(T) {}
- // expected-note@+5 {{candidate function [with T = void (*)(int) __attribute__((noreturn))] not viable: no overload of 'baz' matching 'void (*)(int) __attribute__((noreturn))' for 1st argument}}
- // expected-note@+4 {{candidate function [with T = void (*)(int) __attribute__((noreturn))] not viable: no overload of 'qux' matching 'void (*)(int) __attribute__((noreturn))' for 1st argument}}
- // expected-note@+3 {{candidate function [with T = void (*)(int) __attribute__((noreturn))] not viable: no overload of 'bar' matching 'void (*)(int) __attribute__((noreturn))' for 1st argument}}
- // expected-note@+2 {{candidate function [with T = void (*)(int)] not viable: no overload of 'bar' matching 'void (*)(int)' for 1st argument}}
- // expected-note@+1 {{candidate function [with T = void (int)] not viable: no overload of 'bar' matching 'void (*)(int)' for 1st argument}}
+ // expected-note@+5 {{candidate function not viable: no overload of 'baz' matching 'void (*)(int) __attribute__((noreturn))' for 1st argument}}
+ // expected-note@+4 {{candidate function not viable: no overload of 'qux' matching 'void (*)(int) __attribute__((noreturn))' for 1st argument}}
+ // expected-note@+3 {{candidate function not viable: no overload of 'bar' matching 'void (*)(int) __attribute__((noreturn))' for 1st argument}}
+ // expected-note@+2 {{candidate function not viable: no overload of 'bar' matching 'void (*)(int)' for 1st argument}}
+ // expected-note@+1 {{candidate function not viable: no overload of 'bar' matching 'void (*)(int)' for 1st argument}}
template <typename T> void accept_T(T) {}
// expected-note@+1 {{candidate function not viable: no overload of 'bar' matching 'void (*)(int)' for 1st argument}}
diff --git a/test/SemaCXX/constant-expression-cxx11.cpp b/test/SemaCXX/constant-expression-cxx11.cpp
index 884f2f30c42f5..066832440c757 100644
--- a/test/SemaCXX/constant-expression-cxx11.cpp
+++ b/test/SemaCXX/constant-expression-cxx11.cpp
@@ -1902,9 +1902,9 @@ namespace ZeroSizeTypes {
namespace BadDefaultInit {
template<int N> struct X { static const int n = N; };
- struct A { // expected-error {{default member initializer for 'k' needed within definition of enclosing class}}
+ struct A {
int k = // expected-note {{default member initializer declared here}}
- X<A().k>::n; // expected-error {{not a constant expression}} expected-note {{implicit default constructor for 'BadDefaultInit::A' first required here}}
+ X<A().k>::n; // expected-error {{default member initializer for 'k' needed within definition of enclosing class}}
};
// FIXME: The "constexpr constructor must initialize all members" diagnostic
diff --git a/test/SemaCXX/cxx1z-constexpr-lambdas.cpp b/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
index 90a07665cbf71..16d5730d3d4cf 100644
--- a/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
+++ b/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
@@ -59,4 +59,118 @@ void f(char c) { //expected-note{{declared here}}
}
}
+
+namespace test_conversion_function_for_non_capturing_lambdas {
+
+namespace ns1 {
+auto L = [](int i) { return i; };
+constexpr int (*fpi)(int) = L;
+static_assert(fpi(3) == 3);
+auto GL = [](auto a) { return a; };
+
+constexpr char (*fp2)(char) = GL;
+constexpr double (*fp3)(double) = GL;
+constexpr const char* (*fp4)(const char*) = GL;
+static_assert(fp2('3') == '3');
+static_assert(fp3(3.14) == 3.14);
+constexpr const char *Str = "abc";
+static_assert(fp4(Str) == Str);
+
+auto NCL = [](int i) { static int j; return j; }; //expected-note{{declared here}}
+constexpr int (*fp5)(int) = NCL;
+constexpr int I = //expected-error{{must be initialized by a constant expression}}
+ fp5(5); //expected-note{{non-constexpr function}}
+
+namespace test_dont_always_instantiate_constexpr_templates {
+
+auto explicit_return_type = [](auto x) -> int { return x.get(); };
+decltype(explicit_return_type(0)) c; // OK
+
+auto deduced_return_type = [](auto x) { return x.get(); }; //expected-error{{not a structure or union}}
+decltype(deduced_return_type(0)) d; //expected-note{{requested here}}
+
+
+
+} // end ns test_dont_always_instantiate_constexpr_templates
+} // end ns1
+
+} // end ns test_conversion_function_for_non_capturing_lambdas
+
+namespace test_lambda_is_cce {
+namespace ns1_simple_lambda {
+
+namespace ns0 {
+constexpr int I = [](auto a) { return a; }(10);
+
+static_assert(I == 10);
+static_assert(10 == [](auto a) { return a; }(10));
+static_assert(3.14 == [](auto a) { return a; }(3.14));
+
+} //end ns0
+
+namespace ns1 {
+constexpr auto f(int i) {
+ double d = 3.14;
+ auto L = [=](auto a) {
+ int Isz = sizeof(i);
+ return sizeof(i) + sizeof(a) + sizeof(d);
+ };
+ int I = L("abc") + L(nullptr);
+ return L;
+}
+constexpr auto L = f(3);
+constexpr auto M = L("abc") + L(nullptr);
+
+static_assert(M == sizeof(int) * 2 + sizeof(double) * 2 + sizeof(nullptr) + sizeof(const char*));
+
+} // end ns1
+
+namespace ns2 {
+constexpr auto f(int i) {
+ auto L = [](auto a) { return a + a; };
+ return L;
+}
+constexpr auto L = f(3);
+constexpr int I = L(6);
+static_assert(I == 12);
+} // end ns2
+
+namespace contained_lambdas_call_operator_is_not_constexpr {
+constexpr auto f(int i) {
+ double d = 3.14;
+ auto L = [=](auto a) { //expected-note{{declared here}}
+ int Isz = sizeof(i);
+ asm("hello");
+ return sizeof(i) + sizeof(a) + sizeof(d);
+ };
+ return L;
+}
+
+constexpr auto L = f(3);
+
+constexpr auto M = // expected-error{{must be initialized by}}
+ L("abc"); //expected-note{{non-constexpr function}}
+
+} // end ns contained_lambdas_call_operator_is_not_constexpr
+
+
+
+} // end ns1_simple_lambda
+
+namespace ns1_unimplemented {
+namespace ns1_captures {
+constexpr auto f(int i) {
+ double d = 3.14;
+ auto L = [=](auto a) { //expected-note{{coming soon}}
+ int Isz = i + d;
+ return sizeof(i) + sizeof(a) + sizeof(d);
+ };
+ return L;
+}
+constexpr auto M = f(3); //expected-error{{constant expression}} expected-note{{in call to}}
+} // end ns1_captures
+} // end ns1_unimplemented
+
+} // end ns test_lambda_is_cce
+
#endif // ndef CPP14_AND_EARLIER
diff --git a/test/SemaCXX/diagnose_if.cpp b/test/SemaCXX/diagnose_if.cpp
new file mode 100644
index 0000000000000..f97b79d03529c
--- /dev/null
+++ b/test/SemaCXX/diagnose_if.cpp
@@ -0,0 +1,460 @@
+// RUN: %clang_cc1 %s -verify -fno-builtin -std=c++14
+
+#define _diagnose_if(...) __attribute__((diagnose_if(__VA_ARGS__)))
+
+namespace type_dependent {
+template <typename T>
+void neverok() _diagnose_if(!T(), "oh no", "error") {} // expected-note 4{{from 'diagnose_if'}}
+
+template <typename T>
+void alwaysok() _diagnose_if(T(), "oh no", "error") {}
+
+template <typename T>
+void alwayswarn() _diagnose_if(!T(), "oh no", "warning") {} // expected-note 4{{from 'diagnose_if'}}
+
+template <typename T>
+void neverwarn() _diagnose_if(T(), "oh no", "warning") {}
+
+void runAll() {
+ alwaysok<int>();
+ alwaysok<int>();
+
+ {
+ void (*pok)() = alwaysok<int>;
+ pok = &alwaysok<int>;
+ }
+
+ neverok<int>(); // expected-error{{oh no}}
+ neverok<short>(); // expected-error{{oh no}}
+
+ {
+ void (*pok)() = neverok<int>; // expected-error{{oh no}}
+ }
+ {
+ void (*pok)();
+ pok = &neverok<int>; // expected-error{{oh no}}
+ }
+
+ alwayswarn<int>(); // expected-warning{{oh no}}
+ alwayswarn<short>(); // expected-warning{{oh no}}
+ {
+ void (*pok)() = alwayswarn<int>; // expected-warning{{oh no}}
+ pok = &alwayswarn<int>; // expected-warning{{oh no}}
+ }
+
+ neverwarn<int>();
+ neverwarn<short>();
+ {
+ void (*pok)() = neverwarn<int>;
+ pok = &neverwarn<int>;
+ }
+}
+
+template <typename T>
+void errorIf(T a) _diagnose_if(T() != a, "oh no", "error") {} // expected-note {{candidate disabled: oh no}}
+
+template <typename T>
+void warnIf(T a) _diagnose_if(T() != a, "oh no", "warning") {} // expected-note {{from 'diagnose_if'}}
+
+void runIf() {
+ errorIf(0);
+ errorIf(1); // expected-error{{call to unavailable function}}
+
+ warnIf(0);
+ warnIf(1); // expected-warning{{oh no}}
+}
+}
+
+namespace value_dependent {
+template <int N>
+void neverok() _diagnose_if(N == 0 || N != 0, "oh no", "error") {} // expected-note 4{{from 'diagnose_if'}}
+
+template <int N>
+void alwaysok() _diagnose_if(N == 0 && N != 0, "oh no", "error") {}
+
+template <int N>
+void alwayswarn() _diagnose_if(N == 0 || N != 0, "oh no", "warning") {} // expected-note 4{{from 'diagnose_if'}}
+
+template <int N>
+void neverwarn() _diagnose_if(N == 0 && N != 0, "oh no", "warning") {}
+
+void runAll() {
+ alwaysok<0>();
+ alwaysok<1>();
+
+ {
+ void (*pok)() = alwaysok<0>;
+ pok = &alwaysok<0>;
+ }
+
+ neverok<0>(); // expected-error{{oh no}}
+ neverok<1>(); // expected-error{{oh no}}
+
+ {
+ void (*pok)() = neverok<0>; // expected-error{{oh no}}
+ }
+ {
+ void (*pok)();
+ pok = &neverok<0>; // expected-error{{oh no}}
+ }
+
+ alwayswarn<0>(); // expected-warning{{oh no}}
+ alwayswarn<1>(); // expected-warning{{oh no}}
+ {
+ void (*pok)() = alwayswarn<0>; // expected-warning{{oh no}}
+ pok = &alwayswarn<0>; // expected-warning{{oh no}}
+ }
+
+ neverwarn<0>();
+ neverwarn<1>();
+ {
+ void (*pok)() = neverwarn<0>;
+ pok = &neverwarn<0>;
+ }
+}
+
+template <int N>
+void errorIf(int a) _diagnose_if(N != a, "oh no", "error") {} // expected-note {{candidate disabled: oh no}}
+
+template <int N>
+void warnIf(int a) _diagnose_if(N != a, "oh no", "warning") {} // expected-note {{from 'diagnose_if'}}
+
+void runIf() {
+ errorIf<0>(0);
+ errorIf<0>(1); // expected-error{{call to unavailable function}}
+
+ warnIf<0>(0);
+ warnIf<0>(1); // expected-warning{{oh no}}
+}
+}
+
+namespace no_overload_interaction {
+void foo(int) _diagnose_if(1, "oh no", "error"); // expected-note{{from 'diagnose_if'}}
+void foo(short);
+
+void bar(int);
+void bar(short) _diagnose_if(1, "oh no", "error");
+
+void fooArg(int a) _diagnose_if(a, "oh no", "error"); // expected-note{{candidate disabled: oh no}}
+void fooArg(short); // expected-note{{candidate function}}
+
+void barArg(int);
+void barArg(short a) _diagnose_if(a, "oh no", "error");
+
+void runAll() {
+ foo(1); // expected-error{{oh no}}
+ bar(1);
+
+ fooArg(1); // expected-error{{call to unavailable function}}
+ barArg(1);
+
+ auto p = foo; // expected-error{{incompatible initializer of type '<overloaded function type>'}}
+}
+}
+
+namespace with_default_args {
+void foo(int a = 0) _diagnose_if(a, "oh no", "warning"); // expected-note 1{{from 'diagnose_if'}}
+void bar(int a = 1) _diagnose_if(a, "oh no", "warning"); // expected-note 2{{from 'diagnose_if'}}
+
+void runAll() {
+ foo();
+ foo(0);
+ foo(1); // expected-warning{{oh no}}
+
+ bar(); // expected-warning{{oh no}}
+ bar(0);
+ bar(1); // expected-warning{{oh no}}
+}
+}
+
+namespace naked_mem_expr {
+struct Foo {
+ void foo(int a) _diagnose_if(a, "should warn", "warning"); // expected-note{{from 'diagnose_if'}}
+ void bar(int a) _diagnose_if(a, "oh no", "error"); // expected-note{{from 'diagnose_if'}}
+};
+
+void runFoo() {
+ Foo().foo(0);
+ Foo().foo(1); // expected-warning{{should warn}}
+
+ Foo().bar(0);
+ Foo().bar(1); // expected-error{{oh no}}
+}
+}
+
+namespace class_template {
+template <typename T>
+struct Errors {
+ void foo(int i) _diagnose_if(i, "bad i", "error"); // expected-note{{from 'diagnose_if'}}
+ void bar(int i) _diagnose_if(i != T(), "bad i", "error"); // expected-note{{from 'diagnose_if'}}
+
+ void fooOvl(int i) _diagnose_if(i, "int bad i", "error"); // expected-note 2{{int bad i}}
+ void fooOvl(short i) _diagnose_if(i, "short bad i", "error"); // expected-note 2{{short bad i}}
+
+ void barOvl(int i) _diagnose_if(i != T(), "int bad i", "error"); // expected-note 2{{int bad i}}
+ void barOvl(short i) _diagnose_if(i != T(), "short bad i", "error"); // expected-note 2{{short bad i}}
+};
+
+void runErrors() {
+ Errors<int>().foo(0);
+ Errors<int>().foo(1); // expected-error{{bad i}}
+
+ Errors<int>().bar(0);
+ Errors<int>().bar(1); // expected-error{{bad i}}
+
+ Errors<int>().fooOvl(0);
+ Errors<int>().fooOvl(1); // expected-error{{call to unavailable}}
+ Errors<int>().fooOvl(short(0));
+ Errors<int>().fooOvl(short(1)); // expected-error{{call to unavailable}}
+
+ Errors<int>().barOvl(0);
+ Errors<int>().barOvl(1); // expected-error{{call to unavailable}}
+ Errors<int>().barOvl(short(0));
+ Errors<int>().barOvl(short(1)); // expected-error{{call to unavailable}}
+}
+
+template <typename T>
+struct Warnings {
+ void foo(int i) _diagnose_if(i, "bad i", "warning"); // expected-note{{from 'diagnose_if'}}
+ void bar(int i) _diagnose_if(i != T(), "bad i", "warning"); // expected-note{{from 'diagnose_if'}}
+
+ void fooOvl(int i) _diagnose_if(i, "int bad i", "warning"); // expected-note{{from 'diagnose_if'}}
+ void fooOvl(short i) _diagnose_if(i, "short bad i", "warning"); // expected-note{{from 'diagnose_if'}}
+
+ void barOvl(int i) _diagnose_if(i != T(), "int bad i", "warning"); // expected-note{{from 'diagnose_if'}}
+ void barOvl(short i) _diagnose_if(i != T(), "short bad i", "warning"); // expected-note{{from 'diagnose_if'}}
+};
+
+void runWarnings() {
+ Warnings<int>().foo(0);
+ Warnings<int>().foo(1); // expected-warning{{bad i}}
+
+ Warnings<int>().bar(0);
+ Warnings<int>().bar(1); // expected-warning{{bad i}}
+
+ Warnings<int>().fooOvl(0);
+ Warnings<int>().fooOvl(1); // expected-warning{{int bad i}}
+ Warnings<int>().fooOvl(short(0));
+ Warnings<int>().fooOvl(short(1)); // expected-warning{{short bad i}}
+
+ Warnings<int>().barOvl(0);
+ Warnings<int>().barOvl(1); // expected-warning{{int bad i}}
+ Warnings<int>().barOvl(short(0));
+ Warnings<int>().barOvl(short(1)); // expected-warning{{short bad i}}
+}
+}
+
+namespace template_specialization {
+template <typename T>
+struct Foo {
+ void foo() _diagnose_if(1, "override me", "error"); // expected-note{{from 'diagnose_if'}}
+ void bar(int i) _diagnose_if(i, "bad i", "error"); // expected-note{{from 'diagnose_if'}}
+ void baz(int i);
+};
+
+template <>
+struct Foo<int> {
+ void foo();
+ void bar(int i);
+ void baz(int i) _diagnose_if(i, "bad i", "error"); // expected-note{{from 'diagnose_if'}}
+};
+
+void runAll() {
+ Foo<double>().foo(); // expected-error{{override me}}
+ Foo<int>().foo();
+
+ Foo<double>().bar(1); // expected-error{{bad i}}
+ Foo<int>().bar(1);
+
+ Foo<double>().baz(1);
+ Foo<int>().baz(1); // expected-error{{bad i}}
+}
+}
+
+namespace late_constexpr {
+constexpr int foo();
+constexpr int foo(int a);
+
+void bar() _diagnose_if(foo(), "bad foo", "error"); // expected-note{{from 'diagnose_if'}} expected-note{{not viable: requires 0 arguments}}
+void bar(int a) _diagnose_if(foo(a), "bad foo", "error"); // expected-note{{bad foo}}
+
+void early() {
+ bar();
+ bar(0);
+ bar(1);
+}
+
+constexpr int foo() { return 1; }
+constexpr int foo(int a) { return a; }
+
+void late() {
+ bar(); // expected-error{{bad foo}}
+ bar(0);
+ bar(1); // expected-error{{call to unavailable function}}
+}
+}
+
+namespace late_parsed {
+struct Foo {
+ int i;
+ constexpr Foo(int i): i(i) {}
+ constexpr bool isFooable() const { return i; }
+
+ void go() const _diagnose_if(isFooable(), "oh no", "error") {} // expected-note{{from 'diagnose_if'}}
+ operator int() const _diagnose_if(isFooable(), "oh no", "error") { return 1; } // expected-note{{oh no}}
+
+ void go2() const _diagnose_if(isFooable(), "oh no", "error") // expected-note{{oh no}}
+ __attribute__((enable_if(true, ""))) {}
+ void go2() const _diagnose_if(isFooable(), "oh no", "error") {} // expected-note{{oh no}}
+
+ constexpr int go3() const _diagnose_if(isFooable(), "oh no", "error")
+ __attribute__((enable_if(true, ""))) {
+ return 1;
+ }
+
+ constexpr int go4() const _diagnose_if(isFooable(), "oh no", "error") {
+ return 1;
+ }
+ constexpr int go4() const _diagnose_if(isFooable(), "oh no", "error")
+ __attribute__((enable_if(true, ""))) {
+ return 1;
+ }
+
+ // We hope to support emitting these errors in the future. For now, though...
+ constexpr int runGo() const {
+ return go3() + go4();
+ }
+};
+
+void go(const Foo &f) _diagnose_if(f.isFooable(), "oh no", "error") {} // expected-note{{oh no}}
+
+void run() {
+ Foo(0).go();
+ Foo(1).go(); // expected-error{{oh no}}
+
+ (void)int(Foo(0));
+ (void)int(Foo(1)); // expected-error{{uses deleted function}}
+
+ Foo(0).go2();
+ Foo(1).go2(); // expected-error{{call to unavailable member function}}
+
+ go(Foo(0));
+ go(Foo(1)); // expected-error{{call to unavailable function}}
+}
+}
+
+namespace member_templates {
+struct Foo {
+ int i;
+ constexpr Foo(int i): i(i) {}
+ constexpr bool bad() const { return i; }
+
+ template <typename T> T getVal() _diagnose_if(bad(), "oh no", "error") { // expected-note{{oh no}}
+ return T();
+ }
+
+ template <typename T>
+ constexpr T getVal2() const _diagnose_if(bad(), "oh no", "error") { // expected-note{{oh no}}
+ return T();
+ }
+
+ template <typename T>
+ constexpr operator T() const _diagnose_if(bad(), "oh no", "error") { // expected-note{{oh no}}
+ return T();
+ }
+
+ // We hope to support emitting these errors in the future.
+ int run() { return getVal<int>() + getVal2<int>() + int(*this); }
+};
+
+void run() {
+ Foo(0).getVal<int>();
+ Foo(1).getVal<int>(); // expected-error{{call to unavailable member function}}
+
+ Foo(0).getVal2<int>();
+ Foo(1).getVal2<int>(); // expected-error{{call to unavailable member function}}
+
+ (void)int(Foo(0));
+ (void)int(Foo(1)); // expected-error{{uses deleted function}}
+}
+}
+
+namespace special_member_operators {
+struct Bar { int j; };
+struct Foo {
+ int i;
+ constexpr Foo(int i): i(i) {}
+ constexpr bool bad() const { return i; }
+ const Bar *operator->() const _diagnose_if(bad(), "oh no", "error") { // expected-note{{oh no}}
+ return nullptr;
+ }
+ void operator()() const _diagnose_if(bad(), "oh no", "error") {} // expected-note{{oh no}}
+};
+
+struct ParenOverload {
+ int i;
+ constexpr ParenOverload(int i): i(i) {}
+ constexpr bool bad() const { return i; }
+ void operator()(double) const _diagnose_if(bad(), "oh no", "error") {} // expected-note 2{{oh no}}
+ void operator()(int) const _diagnose_if(bad(), "oh no", "error") {} // expected-note 2{{oh no}}
+};
+
+struct ParenTemplate {
+ int i;
+ constexpr ParenTemplate(int i): i(i) {}
+ constexpr bool bad() const { return i; }
+ template <typename T>
+ void operator()(T) const _diagnose_if(bad(), "oh no", "error") {} // expected-note 2{{oh no}}
+};
+
+void run() {
+ (void)Foo(0)->j;
+ (void)Foo(1)->j; // expected-error{{selected unavailable operator '->'}}
+
+ Foo(0)();
+ Foo(1)(); // expected-error{{unavailable function call operator}}
+
+ ParenOverload(0)(1);
+ ParenOverload(0)(1.);
+
+ ParenOverload(1)(1); // expected-error{{unavailable function call operator}}
+ ParenOverload(1)(1.); // expected-error{{unavailable function call operator}}
+
+ ParenTemplate(0)(1);
+ ParenTemplate(0)(1.);
+
+ ParenTemplate(1)(1); // expected-error{{unavailable function call operator}}
+ ParenTemplate(1)(1.); // expected-error{{unavailable function call operator}}
+}
+
+void runLambda() {
+ auto L1 = [](int i) _diagnose_if(i, "oh no", "error") {}; // expected-note{{oh no}} expected-note{{conversion candidate}}
+ L1(0);
+ L1(1); // expected-error{{call to unavailable function call}}
+}
+}
+
+namespace ctors {
+struct Foo {
+ int I;
+ constexpr Foo(int I): I(I) {}
+
+ constexpr const Foo &operator=(const Foo &) const // expected-note 2{{disabled: oh no}}
+ _diagnose_if(I, "oh no", "error") {
+ return *this;
+ }
+
+ constexpr const Foo &operator=(const Foo &&) const // expected-note{{disabled: oh no}} expected-note{{no known conversion}}
+ _diagnose_if(I, "oh no", "error") {
+ return *this;
+ }
+};
+
+void run() {
+ constexpr Foo F{0};
+ constexpr Foo F2{1};
+
+ F2 = F; // expected-error{{selected unavailable operator}}
+ F2 = Foo{2}; // expected-error{{selected unavailable operator}}
+}
+}
diff --git a/test/SemaCXX/enable_if.cpp b/test/SemaCXX/enable_if.cpp
index 0f8fc9b2652ab..eababc34d3702 100644
--- a/test/SemaCXX/enable_if.cpp
+++ b/test/SemaCXX/enable_if.cpp
@@ -464,3 +464,11 @@ void runFoo() {
Foo<double>().bar(1);
}
}
+
+namespace instantiate_constexpr_in_enable_if {
+ template<typename T> struct X {
+ static constexpr bool ok() { return true; }
+ void f() __attribute__((enable_if(ok(), "")));
+ };
+ void g() { X<int>().f(); }
+}
diff --git a/test/SemaCXX/implicit-exception-spec.cpp b/test/SemaCXX/implicit-exception-spec.cpp
index 12871b8ce7073..fc86d1810ba5a 100644
--- a/test/SemaCXX/implicit-exception-spec.cpp
+++ b/test/SemaCXX/implicit-exception-spec.cpp
@@ -16,34 +16,32 @@ namespace InClassInitializers {
// Noexcept::Noexcept is not declared constexpr, therefore noexcept(Noexcept())
// is false.
bool ThrowSomething() noexcept(false);
- struct ConstExpr { // expected-error {{default member initializer for 'b' needed}}
- bool b = noexcept(ConstExpr()) && ThrowSomething(); // expected-note {{declared here}}
- // expected-note@-1 {{implicit default constructor for 'InClassInitializers::ConstExpr' first required here}}
+ struct ConstExpr {
+ bool b = // expected-note {{declared here}}
+ noexcept(ConstExpr()) && ThrowSomething(); // expected-error {{default member initializer for 'b' needed}}
};
// Much more obviously broken: we can't parse the initializer without already
// knowing whether it produces a noexcept expression.
- struct TemplateArg { // expected-error {{default member initializer for 'n' needed}}
- int n = ExceptionIf<noexcept(TemplateArg())>::f(); // expected-note {{declared here}}
- // expected-note@-1 {{implicit default constructor for 'InClassInitializers::TemplateArg' first required here}}
+ struct TemplateArg {
+ int n = // expected-note {{declared here}}
+ ExceptionIf<noexcept(TemplateArg())>::f(); // expected-error {{default member initializer for 'n' needed}}
};
// And within a nested class.
- struct Nested { // expected-note {{implicit default constructor for 'InClassInitializers::Nested::Inner' first required here}}
- struct Inner { // expected-error {{default member initializer for 'n' needed}}
+ struct Nested {
+ struct Inner {
int n = // expected-note {{declared here}}
- ExceptionIf<noexcept(Nested())>::f(); // expected-note {{implicit default constructor for 'InClassInitializers::Nested' first required here}}
- } inner;
+ ExceptionIf<noexcept(Nested())>::f();
+ } inner; // expected-error {{default member initializer for 'n' needed}}
};
- struct Nested2 { // expected-error {{implicit default constructor for 'InClassInitializers::Nested2' must explicitly initialize the member 'inner' which does not have a default constructor}}
+ struct Nested2 {
struct Inner;
- int n = Inner().n; // expected-note {{implicit default constructor for 'InClassInitializers::Nested2::Inner' first required here}}
- struct Inner { // expected-error {{initializer for 'n' needed}} expected-note {{declared here}}
- // expected-note@+1 {{declared here}}
- int n = ExceptionIf<noexcept(Nested2())>::f();
- // expected-note@-1 {{implicit default constructor for 'InClassInitializers::Nested2' first required here}}
- } inner; // expected-note {{member is declared here}}
+ int n = Inner().n; // expected-error {{initializer for 'n' needed}}
+ struct Inner {
+ int n = ExceptionIf<noexcept(Nested2())>::f(); // expected-note {{declared here}}
+ } inner;
};
}
diff --git a/test/SemaCXX/libstdcxx_gets_hack.cpp b/test/SemaCXX/libstdcxx_gets_hack.cpp
new file mode 100644
index 0000000000000..0d915d01474c3
--- /dev/null
+++ b/test/SemaCXX/libstdcxx_gets_hack.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only %s -std=c++14 -verify
+
+// This is a test for an egregious hack in Clang that works around
+// an issue with libstdc++'s detection of whether glibc provides a
+// ::gets function. If there is no ::gets, ignore
+// using ::gets;
+// in namespace std.
+//
+// See PR18402 and gcc.gnu.org/PR77795 for more details.
+
+#ifdef BE_THE_HEADER
+
+#pragma GCC system_header
+namespace std {
+ using ::gets;
+ using ::getx; // expected-error {{no member named 'getx'}}
+}
+
+#else
+
+#define BE_THE_HEADER
+#include "libstdcxx_pointer_return_false_hack.cpp"
+
+namespace foo {
+ using ::gets; // expected-error {{no member named 'gets'}}
+}
+
+#endif
diff --git a/test/SemaCXX/member-init.cpp b/test/SemaCXX/member-init.cpp
index 105c2e49822f8..c296baa5bce70 100644
--- a/test/SemaCXX/member-init.cpp
+++ b/test/SemaCXX/member-init.cpp
@@ -13,10 +13,10 @@ public:
bool b();
int k;
-struct Recurse { // expected-error {{initializer for 'n' needed}}
+struct Recurse {
int &n = // expected-note {{declared here}}
b() ?
- Recurse().n : // expected-note {{implicit default constructor for 'Recurse' first required here}}
+ Recurse().n : // expected-error {{initializer for 'n' needed}}
k;
};
@@ -128,21 +128,19 @@ A::A() {}
namespace template_default_ctor {
struct A {
template <typename T>
- struct B { // expected-error {{initializer for 'm1' needed}}
+ struct B {
int m1 = 0; // expected-note {{declared here}}
};
- // expected-note@+1 {{implicit default constructor for 'template_default_ctor::A::B<int>' first required here}}
- enum { NOE = noexcept(B<int>()) };
+ enum { NOE = noexcept(B<int>()) }; // expected-error {{initializer for 'm1' needed}}
};
}
namespace default_ctor {
struct A {
- struct B { // expected-error {{initializer for 'm1' needed}}
+ struct B {
int m1 = 0; // expected-note {{declared here}}
};
- // expected-note@+1 {{implicit default constructor for 'default_ctor::A::B' first required here}}
- enum { NOE = noexcept(B()) };
+ enum { NOE = noexcept(B()) }; // expected-error {{initializer for 'm1' needed}}
};
}
@@ -150,19 +148,17 @@ namespace member_template {
struct A {
template <typename T>
struct B {
- struct C { // expected-error {{initializer for 'm1' needed}}
+ struct C {
int m1 = 0; // expected-note {{declared here}}
};
template <typename U>
- struct D { // expected-error {{initializer for 'm1' needed}}
+ struct D {
int m1 = 0; // expected-note {{declared here}}
};
};
enum {
- // expected-note@+1 {{implicit default constructor for 'member_template::A::B<int>::C' first required here}}
- NOE1 = noexcept(B<int>::C()),
- // expected-note@+1 {{implicit default constructor for 'member_template::A::B<int>::D<int>' first required here}}
- NOE2 = noexcept(B<int>::D<int>())
+ NOE1 = noexcept(B<int>::C()), // expected-error {{initializer for 'm1' needed}}
+ NOE2 = noexcept(B<int>::D<int>()) // expected-error {{initializer for 'm1' needed}}
};
};
}
diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp
index 3a01bf24b31af..0e3a9ee50bb24 100644
--- a/test/SemaCXX/overload-call.cpp
+++ b/test/SemaCXX/overload-call.cpp
@@ -338,7 +338,7 @@ namespace PR5756 {
// Tests the exact text used to note the candidates
namespace test1 {
- template <class T> void foo(T t, unsigned N); // expected-note {{candidate function [with T = int] not viable: no known conversion from 'const char [6]' to 'unsigned int' for 2nd argument}}
+ template <class T> void foo(T t, unsigned N); // expected-note {{candidate function not viable: no known conversion from 'const char [6]' to 'unsigned int' for 2nd argument}}
void foo(int n, char N); // expected-note {{candidate function not viable: no known conversion from 'const char [6]' to 'char' for 2nd argument}}
void foo(int n, const char *s, int t); // expected-note {{candidate function not viable: requires 3 arguments, but 2 were provided}}
void foo(int n, const char *s, int t, ...); // expected-note {{candidate function not viable: requires at least 3 arguments, but 2 were provided}}
diff --git a/test/SemaCXX/overload-member-call.cpp b/test/SemaCXX/overload-member-call.cpp
index e0f34d937f6f1..6e64b25d6b532 100644
--- a/test/SemaCXX/overload-member-call.cpp
+++ b/test/SemaCXX/overload-member-call.cpp
@@ -70,7 +70,7 @@ void test_X2(X2 *x2p, const X2 *cx2p) {
// Tests the exact text used to note the candidates
namespace test1 {
class A {
- template <class T> void foo(T t, unsigned N); // expected-note {{candidate function [with T = int] not viable: no known conversion from 'const char [6]' to 'unsigned int' for 2nd argument}}
+ template <class T> void foo(T t, unsigned N); // expected-note {{candidate function not viable: no known conversion from 'const char [6]' to 'unsigned int' for 2nd argument}}
void foo(int n, char N); // expected-note {{candidate function not viable: no known conversion from 'const char [6]' to 'char' for 2nd argument}}
void foo(int n, const char *s, int t); // expected-note {{candidate function not viable: requires 3 arguments, but 2 were provided}}
void foo(int n, const char *s, int t, ...); // expected-note {{candidate function not viable: requires at least 3 arguments, but 2 were provided}}
diff --git a/test/SemaCXX/undefined-internal.cpp b/test/SemaCXX/undefined-internal.cpp
index 59e6fdf9af06c..32151b71ea17d 100644
--- a/test/SemaCXX/undefined-internal.cpp
+++ b/test/SemaCXX/undefined-internal.cpp
@@ -186,10 +186,15 @@ namespace OverloadUse {
namespace {
void f();
void f(int); // expected-warning {{function 'OverloadUse::(anonymous namespace)::f' has internal linkage but is not defined}}
+ void f(int, int); // expected-warning {{function 'OverloadUse::(anonymous namespace)::f' has internal linkage but is not defined}}
+ }
+ template<void x()> void t() { x(); }
+ template<void x(int)> void t(int*) { x(10); }
+ template<void x(int, int)> void t(int*, int*) {}
+ void g(int n) {
+ t<f>(&n); // expected-note {{used here}}
+ t<f>(&n, &n); // expected-note {{used here}}
}
- template<void x()> void t(int*) { x(); }
- template<void x(int)> void t(long*) { x(10); } // expected-note {{used here}}
- void g() { long a; t<f>(&a); }
}
namespace test7 {
diff --git a/test/SemaTemplate/alias-templates.cpp b/test/SemaTemplate/alias-templates.cpp
index bcdc84e19f7e7..d70e86817849f 100644
--- a/test/SemaTemplate/alias-templates.cpp
+++ b/test/SemaTemplate/alias-templates.cpp
@@ -244,3 +244,13 @@ namespace redecl {
template<typename = void> using A = int;
A<> a; // ok
}
+
+namespace PR31514 {
+ template<typename T, typename> using EnableTupleSize = T;
+
+ template<typename T> struct tuple_size { static const int value = 0; };
+ template<typename T> struct tuple_size<EnableTupleSize<const T, decltype(tuple_size<T>::value)>> {};
+ template<typename T> struct tuple_size<EnableTupleSize<volatile T, decltype(tuple_size<T>::value)>> {};
+
+ tuple_size<const int> t;
+}
diff --git a/test/SemaTemplate/constexpr-instantiate.cpp b/test/SemaTemplate/constexpr-instantiate.cpp
index e8e3e7dd5a088..dfb8a07d3b7dd 100644
--- a/test/SemaTemplate/constexpr-instantiate.cpp
+++ b/test/SemaTemplate/constexpr-instantiate.cpp
@@ -77,20 +77,19 @@ namespace Reference {
}
namespace Unevaluated {
- // We follow g++ in treating any reference to a constexpr function template
- // specialization as requiring an instantiation, even if it occurs in an
- // unevaluated context.
+ // We follow the current proposed resolution of core issue 1581: a constexpr
+ // function template specialization requires a definition if:
+ // * it is odr-used, or would be odr-used except that it appears within the
+ // definition of a template, or
+ // * it is used within a braced-init-list, where it may be necessary for
+ // detecting narrowing conversions.
//
- // We go slightly further than g++, and also trigger the implicit definition
- // of a defaulted special member in the same circumstances. This seems scary,
- // since a lot of classes have constexpr special members in C++11, but the
- // only observable impact should be the implicit instantiation of constexpr
- // special member templates (defaulted special members should only be
- // generated if they are well-formed, and non-constexpr special members in a
- // base or member cause the class's special member to not be constexpr).
+ // We apply this both for instantiating constexpr function template
+ // specializations and for implicitly defining defaulted constexpr special
+ // member functions.
//
- // FIXME: None of this is required by the C++ standard. The rules in this
- // area are poorly specified, so this is subject to change.
+ // FIXME: None of this is required by the C++ standard yet. The rules in this
+ // area are subject to change.
namespace NotConstexpr {
template<typename T> struct S {
S() : n(0) {}
@@ -98,16 +97,35 @@ namespace Unevaluated {
int n;
};
struct U : S<int> {};
- decltype(U(U())) u; // ok, don't instantiate S<int>::S() because it wasn't declared constexpr
+ decltype(U(U())) u;
}
namespace Constexpr {
template<typename T> struct S {
constexpr S() : n(0) {}
- constexpr S(const S&) : n(T::error) {} // expected-error {{has no members}}
+ constexpr S(const S&) : n(T::error) {}
int n;
};
- struct U : S<int> {}; // expected-note {{instantiation}}
- decltype(U(U())) u; // expected-note {{here}}
+ struct U : S<int> {};
+ decltype(U(U())) u;
+ }
+ namespace ConstexprList {
+ template<int N> struct S {
+ constexpr S() : n(0) {
+ static_assert(N >= 0, "");
+ }
+ constexpr operator int() const { return 0; }
+ int n;
+ };
+ struct U : S<0> {};
+ // ok, trigger instantiation within a list
+ decltype(char{U()}) t0;
+ decltype(new char{S<1>()}) t1; // expected-warning {{side effects}}
+ decltype((char){S<2>()}) t2;
+ decltype(+(char[1]){{S<3>()}}) t3;
+ // do not trigger instantiation outside a list
+ decltype(char(S<-1>())) u1;
+ decltype(new char(S<-2>())) u2; // expected-warning {{side effects}}
+ decltype((char)(S<-3>())) u3;
}
namespace PR11851_Comment0 {
@@ -190,6 +208,32 @@ namespace Unevaluated {
constexpr duration max = duration();
}
}
+
+ // For variables, we instantiate when they are used in a context in which
+ // evaluation could be required (odr-used, used in a template whose
+ // instantiations would odr-use, or used in list initialization), if they
+ // can be used as a constant (const integral or constexpr).
+ namespace Variables {
+ template<int N> struct A {
+ static const int k;
+ static int n;
+ };
+ template<const int *N> struct B {};
+ template<int N> constexpr int A<N>::k = *(int[N]){N}; // expected-error 1+{{negative}}
+ template<int N> int A<N>::n = *(int[N]){0};
+
+ template <typename> void f() {
+ (void)A<-1>::n; // ok
+ (void)A<-1>::k; // expected-note {{instantiation of }}
+ B<&A<-2>::n> b1; // ok
+ B<&A<-2>::k> b2; // expected-note {{instantiation of }}
+ };
+
+ decltype(A<-3>::k) d1 = 0; // ok
+ decltype(char{A<-4>::k}) d2 = 0; // expected-note {{instantiation of }} expected-error {{narrow}} expected-note {{cast}}
+ decltype(char{A<1>::k}) d3 = 0; // ok
+ decltype(char{A<1 + (unsigned char)-1>::k}) d4 = 0; // expected-error {{narrow}} expected-note {{cast}}
+ }
}
namespace NoInstantiationWhenSelectingOverload {
@@ -201,10 +245,17 @@ namespace NoInstantiationWhenSelectingOverload {
int n;
};
- int f(S);
- int f(int);
+ constexpr int f(S) { return 0; }
+ constexpr int f(int) { return 0; }
void g() { f(0); }
- void h() { (void)sizeof(f(0)); }
- void i() { (void)sizeof(f("oops")); } // expected-note {{instantiation of}}
+ void h() { (void)sizeof(char{f(0)}); }
+ void i() { (void)sizeof(char{f("oops")}); } // expected-note {{instantiation of}}
+}
+
+namespace PR20090 {
+ template <typename T> constexpr T fact(T n) {
+ return n == 0 ? 1 : [=] { return n * fact(n - 1); }();
+ }
+ static_assert(fact(0) == 1, "");
}
diff --git a/test/SemaTemplate/deduction.cpp b/test/SemaTemplate/deduction.cpp
index 2275a8b3b7ad2..0c0e7d599ccb7 100644
--- a/test/SemaTemplate/deduction.cpp
+++ b/test/SemaTemplate/deduction.cpp
@@ -342,7 +342,7 @@ namespace deduction_substitution_failure {
template<typename T, typename U> struct A {};
template<typename T> struct A<T, typename Fail<T>::error> {}; // expected-note {{instantiation of}}
- A<int, int> ai; // expected-note {{during template argument deduction for class template partial specialization 'A<T, typename Fail<T>::error>' [with T = int]}}
+ A<int, int> ai; // expected-note {{during template argument deduction for class template partial specialization 'A<T, typename Fail<T>::error>' [with T = int]}} expected-note {{in instantiation of template class 'deduction_substitution_failure::A<int, int>'}}
template<typename T, typename U> int B; // expected-warning 0-1 {{extension}}
template<typename T> int B<T, typename Fail<T>::error> {}; // expected-note {{instantiation of}}
@@ -350,17 +350,39 @@ namespace deduction_substitution_failure {
}
namespace deduction_after_explicit_pack {
- template<typename ...T, typename U> int *f(T ...t, int &r, U *u) { // expected-note {{couldn't infer template argument 'U'}}
+ template<typename ...T, typename U> int *f(T ...t, int &r, U *u) {
return u;
}
template<typename U, typename ...T> int *g(T ...t, int &r, U *u) {
return u;
}
void h(float a, double b, int c) {
- // FIXME: Under DR1388, this appears to be valid.
- f<float&, double&>(a, b, c, &c); // expected-error {{no matching}}
+ f<float&, double&>(a, b, c, &c); // ok
g<int, float&, double&>(a, b, c, &c); // ok
}
+
+ template<class... ExtraArgs>
+ int test(ExtraArgs..., unsigned vla_size, const char *input);
+ int n = test(0, "");
+
+ template <typename... T> void i(T..., int, T..., ...); // expected-note 5{{deduced conflicting}}
+ void j() {
+ i(0);
+ i(0, 1); // expected-error {{no match}}
+ i(0, 1, 2); // expected-error {{no match}}
+ i<>(0);
+ i<>(0, 1); // expected-error {{no match}}
+ i<>(0, 1, 2); // expected-error {{no match}}
+ i<int, int>(0, 1, 2, 3, 4);
+ i<int, int>(0, 1, 2, 3, 4, 5); // expected-error {{no match}}
+ }
+
+ // GCC alarmingly accepts this by deducing T={int} by matching the second
+ // parameter against the first argument, then passing the first argument
+ // through the first parameter.
+ template<typename... T> struct X { X(int); operator int(); };
+ template<typename... T> void p(T..., X<T...>, ...); // expected-note {{deduced conflicting}}
+ void q() { p(X<int>(0), 0); } // expected-error {{no match}}
}
namespace overload_vs_pack {
diff --git a/test/SemaTemplate/default-arguments-cxx0x.cpp b/test/SemaTemplate/default-arguments-cxx0x.cpp
index c52899a8e6d15..d9fa2b4a825ec 100644
--- a/test/SemaTemplate/default-arguments-cxx0x.cpp
+++ b/test/SemaTemplate/default-arguments-cxx0x.cpp
@@ -50,6 +50,8 @@ namespace PR16975 {
bar(T);
};
+ bar<> foo{0};
+
struct baz : public bar<> {
using bar::bar;
};
diff --git a/test/SemaTemplate/instantiate-init.cpp b/test/SemaTemplate/instantiate-init.cpp
index e9be60d16c1fb..244e94f6d6056 100644
--- a/test/SemaTemplate/instantiate-init.cpp
+++ b/test/SemaTemplate/instantiate-init.cpp
@@ -115,9 +115,8 @@ namespace PR13064 {
struct A { explicit A(int); }; // expected-note{{here}}
template<typename T> struct B { T a { 0 }; };
B<A> b;
- // expected-note@+1 {{in instantiation of default member initializer}}
template<typename T> struct C { T a = { 0 }; }; // expected-error{{explicit}}
- C<A> c; // expected-note{{here}}
+ C<A> c; // expected-note {{in instantiation of default member initializer}}
}
namespace PR16903 {
diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp
index 93f11b5657d03..27a0a03f84f46 100644
--- a/test/SemaTemplate/temp_arg_nontype.cpp
+++ b/test/SemaTemplate/temp_arg_nontype.cpp
@@ -173,12 +173,16 @@ namespace pr6249 {
}
namespace PR6723 {
- template<unsigned char C> void f(int (&a)[C]); // expected-note {{candidate template ignored}} \
- // expected-note{{substitution failure [with C = '\x00']}}
+ template<unsigned char C> void f(int (&a)[C]); // expected-note 3{{candidate template ignored: substitution failure [with C = '\x00']}}
+ // expected-note@-1 {{not viable: no known conversion from 'int [512]' to 'int (&)[0]'}}
void g() {
int arr512[512];
f(arr512); // expected-error{{no matching function for call}}
f<512>(arr512); // expected-error{{no matching function for call}}
+
+ int arr0[0];
+ f(arr0); // expected-error{{no matching function for call}}
+ f<0>(arr0); // expected-error{{no matching function for call}}
}
}