Unnamed: 0
int64
0
0
repo_id
stringlengths
5
186
file_path
stringlengths
15
223
content
stringlengths
1
32.8M
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-chain-function-template.cpp
// RUN: %clang_cc1 -chain-include %s -chain-include %s -fsyntax-only %s // Just don't crash. #if !defined(RUN1) #define RUN1 struct CXXRecordDecl { CXXRecordDecl(int); }; template <typename T, typename U> T cast(U u) { return reinterpret_cast<T&>(u); } void test1() { cast<float>(1); } #elif !defined(RUN2) #define RUN2 template <typename T> void test2(T) { cast<CXXRecordDecl>(1.0f); } #else void test3() { cast<CXXRecordDecl>(1.0f); test2(1); } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/fuzzy-pch.c
// Test with pch. // RUN: %clang_cc1 -emit-pch -DFOO -o %t %S/variables.h // RUN: %clang_cc1 -DBAR=int -include-pch %t -fsyntax-only -pedantic %s // RUN: %clang_cc1 -DFOO -DBAR=int -include-pch %t %s // RUN: not %clang_cc1 -DFOO=blah -DBAR=int -include-pch %t %s 2> %t.err // RUN: FileCheck -check-prefix=CHECK-FOO %s < %t.err // RUN: not %clang_cc1 -UFOO -include-pch %t %s 2> %t.err // RUN: FileCheck -check-prefix=CHECK-NOFOO %s < %t.err // RUN: not %clang_cc1 -DFOO -undef -include-pch %t %s 2> %t.err // RUN: FileCheck -check-prefix=CHECK-UNDEF %s < %t.err BAR bar = 17; #ifndef FOO # error FOO was not defined #endif #if FOO != 1 # error FOO has the wrong definition #endif #ifndef BAR # error BAR was not defined #endif // CHECK-FOO: definition of macro 'FOO' differs between the precompiled header ('1') and the command line ('blah') // CHECK-NOFOO: macro 'FOO' was defined in the precompiled header but undef'd on the command line // CHECK-UNDEF: command line contains '-undef' but precompiled header was not built with it
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/pragma-weak.c
// Test this without pch. // RUN: not %clang_cc1 -include %S/pragma-weak.h %s -verify -emit-llvm -o - | FileCheck %s // Test with pch. // RUN: %clang_cc1 -x c-header -emit-pch -o %t %S/pragma-weak.h // RUN: not %clang_cc1 -include-pch %t %s -verify -emit-llvm -o - | FileCheck %s // CHECK: @weakvar = weak global i32 0 int weakvar; // expected-warning {{weak identifier 'undeclaredvar' never declared}}
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/functions.c
// Test this without pch. // RUN: %clang_cc1 -include %S/functions.h -fsyntax-only -verify %s // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t %S/functions.h // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s int f0(int x0, int y0, ...) { return x0 + y0; } float *test_f1(int val, double x, double y) { if (val > 5) return f1(x, y); else return f1(x); // expected-error{{too few arguments to function call}} // [email protected]:7{{'f1' declared here}} } void test_g0(int *x, float * y) { g0(y); // expected-warning{{incompatible pointer types passing 'float *' to parameter of type 'int *'}} // [email protected]:9{{passing argument to parameter here}} g0(x); } void __attribute__((noreturn)) test_abort(int code) { do_abort(code); }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/preprocess.h
// Helper header for preprocess.c PCH test #ifndef PREPROCESS_H #define PREPROCESS_H typedef int a_typedef; #endif // PREPROCESS_H
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx1y-variable-templates.cpp
// No PCH: // RUN: %clang_cc1 -pedantic -std=c++1y -include %s -include %s -verify %s -DNONPCH // RUN: %clang_cc1 -pedantic -std=c++1y -include %s -include %s -verify %s -DNONPCH -DERROR // // With PCH: // RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t.a -DHEADER1 // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.a -emit-pch %s -o %t.b -DHEADER2 // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.b -verify %s -DHEADERUSE #ifndef ERROR // expected-no-diagnostics #endif #ifdef NONPCH #if !defined(HEADER1) #define HEADER1 #undef HEADER2 #undef HEADERUSE #elif !defined(HEADER2) #define HEADER2 #undef HEADERUSE #else #define HEADERUSE #undef HEADER1 #undef HEADER2 #endif #endif // *** HEADER1: First header file #if defined(HEADER1) && !defined(HEADER2) && !defined(HEADERUSE) template<typename T> T var0a = T(); template<typename T> extern T var0b; namespace join { template<typename T> T va = T(100); template<typename T> extern T vb; namespace diff_types { #ifdef ERROR template<typename T> extern float err0; template<typename T> extern T err1; #endif template<typename T> extern T def; } } namespace spec { template<typename T> constexpr T va = T(10); template<> constexpr float va<float> = 1.5; template constexpr int va<int>; template<typename T> T vb = T(); template<> constexpr float vb<float> = 1.5; template<typename T> T vc = T(); template<typename T> constexpr T vd = T(10); template<typename T> T* vd<T*> = new T(); } namespace spec_join1 { template<typename T> T va = T(10); template<> extern float va<float>; extern template int va<int>; template<typename T> T vb = T(10); template<> extern float vb<float>; template<typename T> T vc = T(10); template<typename T> T vd = T(10); template<typename T> extern T* vd<T*>; } #endif // *** HEADER2: Second header file -- including HEADER1 #if defined(HEADER2) && !defined(HEADERUSE) namespace join { template<typename T> extern T va; template<> constexpr float va<float> = 2.5; template<typename T> T vb = T(100); namespace diff_types { #ifdef ERROR template<typename T> extern T err0; // expected-error {{redeclaration of 'err0' with a different type: 'T' vs 'float'}} // expected-note@42 {{previous declaration is here}} template<typename T> extern float err1; // expected-error {{redeclaration of 'err1' with a different type: 'float' vs 'T'}} // expected-note@43 {{previous declaration is here}} #endif template<typename T> extern T def; } } namespace spec_join1 { template<typename T> extern T va; template<> float va<float> = 1.5; extern template int va<int>; template<> float vb<float> = 1.5; template int vb<int>; template<> float vc<float> = 1.5; template int vc<int>; template<typename T> extern T vd; template<typename T> T* vd<T*> = new T(); } #endif // *** HEADERUSE: File using both header files -- including HEADER2 #ifdef HEADERUSE template int var0a<int>; float fvara = var0a<float>; template<typename T> extern T var0a; template<typename T> T var0b = T(); template int var0b<int>; float fvarb = var0b<float>; namespace join { template const int va<const int>; template<> const int va<int> = 50; static_assert(va<float> == 2.5, ""); static_assert(va<int> == 50, ""); template<> constexpr float vb<float> = 2.5; template const int vb<const int>; static_assert(vb<float> == 2.5, ""); static_assert(vb<const int> == 100, ""); namespace diff_types { template<typename T> T def = T(); } } namespace spec { static_assert(va<float> == 1.5, ""); static_assert(va<int> == 10, ""); template<typename T> T* vb<T*> = new T(); int* intpb = vb<int*>; static_assert(vb<float> == 1.5, ""); template<typename T> T* vc<T*> = new T(); template<> constexpr float vc<float> = 1.5; int* intpc = vc<int*>; static_assert(vc<float> == 1.5, ""); char* intpd = vd<char*>; } namespace spec_join1 { template int va<int>; int a = va<int>; template<typename T> extern T vb; int b = vb<int>; int* intpb = vd<int*>; } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/va_arg.cpp
// Test this without pch. // RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include %S/Inputs/va_arg.h %s -emit-llvm -o - // REQUIRES: x86-registered-target // Test with pch. // RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -emit-pch -x c++-header -o %t %S/Inputs/va_arg.h // RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -emit-llvm -o - typedef __SIZE_TYPE__ size_t; extern "C" { int vsnprintf(char * , size_t, const char * , va_list) ; } void f(char *buffer, unsigned count, const char* format, va_list argptr) { vsnprintf(buffer, count, format, argptr); }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/pth.h
// This case came up when using PTH with Boost (<rdar://problem/8227989>). # ifndef R8227989_PREPROCESSOR_CONFIG_CONFIG_HPP # ifndef R8227989_PP_CONFIG_FLAGS # endif # # ifndef R8227989_PP_CONFIG_ERRORS # ifdef NDEBUG # endif # endif # endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/selector-warning.h
typedef struct objc_selector *SEL; @interface Foo - (void) NotOK; @end @implementation Foo - (void) foo { SEL a = @selector(b1ar); a = @selector(b1ar); a = @selector(bar); a = @selector(ok); // expected-warning {{unimplemented selector 'ok'}} a = @selector(ok); a = @selector(NotOK); // expected-warning {{unimplemented selector 'NotOK'}} a = @selector(NotOK); a = @selector(clNotOk); // expected-warning {{unimplemented selector 'clNotOk'}} a = @selector (cl1); a = @selector (cl2); a = @selector (instNotOk); // expected-warning {{unimplemented selector 'instNotOk'}} } @end
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/different-diagnostic-level.c
// RUN: %clang -x c-header %s -Weverything -o %t.h.pch // RUN: %clang -x c %s -w -include %t.h -fsyntax-only -Xclang -verify #ifndef HEADER #define HEADER extern int foo; #else void f() { int a = foo; // Make sure we parsed this by getting an error. int b = bar; // expected-error {{undeclared}} } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/case-insensitive-include.c
// REQUIRES: case-insensitive-filesystem // Test this without pch. // RUN: cp %S/Inputs/case-insensitive-include.h %T // RUN: %clang_cc1 -fsyntax-only %s -include %s -I %T -verify // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t.pch %s -I %T // Modify inode of the header. // RUN: cp %T/case-insensitive-include.h %t.copy // RUN: touch -r %T/case-insensitive-include.h %t.copy // RUN: mv %t.copy %T/case-insensitive-include.h // RUN: %clang_cc1 -fsyntax-only %s -include-pch %t.pch -I %T -verify // expected-no-diagnostics #ifndef HEADER #define HEADER #include "case-insensitive-include.h" #include "Case-Insensitive-Include.h" #else #include "Case-Insensitive-Include.h" #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/badpch.c
// RUN: not %clang_cc1 -fsyntax-only -include-pch %S/Inputs/badpch-empty.h.gch %s 2>&1 | FileCheck -check-prefix=CHECK-EMPTY %s // RUN: not %clang_cc1 -fsyntax-only -include-pch %S/Inputs/badpch-dir.h.gch %s 2>&1 | FileCheck -check-prefix=CHECK-DIR %s // The purpose of this test is to verify that various invalid PCH files are // reported as such. // PR4568: The messages were much improved since the bug was filed on // 2009-07-16, though in the case of the PCH being a directory, the error // message still did not contain the name of the PCH. Also, r149918 which was // submitted on 2012-02-06 introduced a segfault in the case where the PCH is // an empty file and clang was built with assertions. // CHECK-EMPTY: error: input is not a PCH file: '{{.*[/\\]}}badpch-empty.h.gch' // CHECK-DIR:error: no suitable precompiled header file found in directory '{{.*[/\\]}}badpch-dir.h.gch
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/objc_container.h
@protocol P @end @interface NSMutableArray - (id)objectAtIndexedSubscript:(unsigned int)index; - (void)setObject:(id)object atIndexedSubscript:(unsigned int)index; @end @interface NSMutableDictionary - (id)objectForKeyedSubscript:(id)key; - (void)setObject:(id)object forKeyedSubscript:(id)key; @end void all() { NSMutableArray *array; id oldObject = array[10]; array[10] = oldObject; NSMutableDictionary *dictionary; id key; id newObject; oldObject = dictionary[key]; dictionary[key] = newObject; }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx0x-default-delete.cpp
// Without PCH // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -include %s %s // With PCH // RUN: %clang_cc1 -x c++-header -std=c++11 -emit-pch -o %t %s // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -include-pch %t %s #ifndef PASS1 #define PASS1 struct foo { foo() = default; void bar() = delete; }; struct baz { ~baz() = delete; }; class quux { ~quux() = default; }; struct A { A(const A&) = default; template<typename T> A(T&&); }; #else foo::foo() { } // expected-error{{definition of explicitly defaulted default constructor}} foo f; void fn() { f.bar(); // expected-error{{deleted function}} expected-note@12{{deleted here}} } baz bz; // expected-error{{deleted function}} expected-note@16{{deleted here}} quux qx; // expected-error{{private destructor}} expected-note@20{{private here}} struct B { A a; }; struct C { mutable A a; }; static_assert(__is_trivially_constructible(B, const B&), ""); static_assert(!__is_trivially_constructible(B, B&&), ""); static_assert(!__is_trivially_constructible(C, const C&), ""); static_assert(!__is_trivially_constructible(C, C&&), ""); #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-reference.h
// Header for PCH test cxx-reference.cpp typedef char (&LR); typedef char (&&RR); char c; char &lr = c; char &&rr = 'c'; LR &lrlr = c; LR &&rrlr = c; RR &lrrr = c; RR &&rrrr = 'c';
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/reinclude1.h
namespace A { int x; int y; } int foo; #define foo foo
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/enum.c
// Test this without pch. // RUN: %clang_cc1 -include %S/enum.h -fsyntax-only -verify %s // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t %S/enum.h // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s // expected-no-diagnostics int i = Red; int return_enum_constant() { int result = aRoundShape; return result; } enum Shape s = Triangle;
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/ocl_types.h
/* Used with the ocl_types.cl test */ // image1d_t typedef image1d_t img1d_t; // image1d_array_t typedef image1d_array_t img1darr_t; // image1d_buffer_t typedef image1d_buffer_t img1dbuff_t; // image2d_t typedef image2d_t img2d_t; // image2d_array_t typedef image2d_array_t img2darr_t; // image3d_t typedef image3d_t img3d_t; // sampler_t typedef sampler_t smp_t; // event_t typedef event_t evt_t;
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/headersearch.cpp
// Test reading of PCH with changed location of original input files, // i.e. invoking header search. // Generate the original files: // RUN: rm -rf %t_orig %t_moved // RUN: mkdir -p %t_orig/sub %t_orig/sub2 // RUN: echo 'struct orig_sub{char c; int i; };' > %t_orig/sub/orig_sub.h // RUN: echo 'void orig_sub2_1();' > %t_orig/sub2/orig_sub2_1.h // RUN: echo '#include "orig_sub2_1.h"' > %t_orig/sub2/orig_sub2.h // RUN: echo 'template <typename T> void tf() { orig_sub2_1(); T::foo(); }' >> %t_orig/sub2/orig_sub2.h // RUN: echo 'void foo() {}' > %t_orig/tmp2.h // RUN: echo '#include "tmp2.h"' > %t_orig/all.h // RUN: echo '#include "sub/orig_sub.h"' >> %t_orig/all.h // RUN: echo '#include "orig_sub2.h"' >> %t_orig/all.h // RUN: echo 'int all();' >> %t_orig/all.h // This test relies on -Wpadded, which is only implemented for Itanium record // layout. // Generate the PCH: // RUN: cd %t_orig && %clang_cc1 -triple %itanium_abi_triple -x c++ -emit-pch -o all.h.pch -Isub2 all.h // RUN: cp -R %t_orig %t_moved // Check diagnostic with location in original source: // RUN: %clang_cc1 -triple %itanium_abi_triple -include-pch all.h.pch -I%t_moved -I%t_moved/sub2 -Wpadded -emit-llvm-only %s 2> %t.stderr // RUN: grep 'struct orig_sub' %t.stderr // Check diagnostic with 2nd location in original source: // RUN: not %clang_cc1 -triple %itanium_abi_triple -DREDECL -include-pch all.h.pch -I%t_moved -I%t_moved/sub2 -emit-llvm-only %s 2> %t.stderr // RUN: grep 'void foo' %t.stderr // Check diagnostic with instantiation location in original source: // RUN: not %clang_cc1 -triple %itanium_abi_triple -DINSTANTIATION -include-pch all.h.pch -I%t_moved -I%t_moved/sub2 -emit-llvm-only %s 2> %t.stderr // RUN: grep 'orig_sub2_1' %t.stderr void qq(orig_sub*) {all();} #ifdef REDECL float foo() {return 0;} #endif #ifdef INSTANTIATION void f() { tf<int>(); } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cmdline-include.c
// RUN: %clang_cc1 -include %S/cmdline-include1.h -x c-header %S/cmdline-include2.h -emit-pch -o %t // RUN: %clang_cc1 %s -include-pch %t -fsyntax-only -verify // RUN: %clang_cc1 -x c-header %S/cmdline-include1.h -emit-pch -o %t // RUN: %clang_cc1 %s -include-pch %t -include %S/cmdline-include2.h -fsyntax-only -verify // expected-no-diagnostics int g = x1 + x2;
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx11-statement-attributes.cpp
// Sanity check. // RUN: %clang_cc1 -include %S/Inputs/cxx11-statement-attributes.h -std=c++11 -Wimplicit-fallthrough -fsyntax-only %s -o - -verify // Run the same tests, this time with the attributes loaded from the PCH file. // RUN: %clang_cc1 -x c++-header -emit-pch -std=c++11 -o %t %S/Inputs/cxx11-statement-attributes.h // RUN: %clang_cc1 -include-pch %t -std=c++11 -Wimplicit-fallthrough -fsyntax-only %s -o - -verify // expected-warning@Inputs/cxx11-statement-attributes.h:10 {{fallthrough annotation does not directly precede switch label}} void g(int n) { f<1>(n); // expected-note {{in instantiation of function template specialization 'f<1>' requested here}} }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-decls.c
// Test this without pch. // RUN: %clang_cc1 -include %S/Inputs/chain-decls1.h -include %S/Inputs/chain-decls2.h -fsyntax-only -verify %s // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-decls1.h // RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-decls2.h -include-pch %t1 // RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s // RUN: %clang_cc1 -ast-print -include-pch %t2 %s | FileCheck %s // expected-no-diagnostics // CHECK: void f(); // CHECK: void g(); int h() { f(); g(); struct one x; one(); struct two y; two(); struct three z; many(0); struct many m; noret(); }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/attrs-PR8406.c
// Test this without pch. // RUN: %clang_cc1 -include %s -emit-llvm -o - %s | FileCheck %s // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t %s // RUN: %clang_cc1 -include-pch %t -emit-llvm -o - %s | FileCheck %s #ifndef HEADER #define HEADER struct Bar { // CHECK: align 512 int buffer[123] __attribute__((__aligned__(512))); }; #else void foo() { struct Bar bar; } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/modified-header-crash.h
int foo;
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/reinclude.cpp
// Test without PCH // RUN: %clang_cc1 %s -include %S/reinclude1.h -include %S/reinclude2.h -fsyntax-only -verify // RUN: %clang_cc1 -x c++-header %S/reinclude1.h -emit-pch -o %t1 // RUN: %clang_cc1 -x c++-header %S/reinclude2.h -include-pch %t1 -emit-pch -o %t2 // RUN: %clang_cc1 %s -include-pch %t2 -fsyntax-only -verify // RUN: %clang_cc1 -x c++-header %S/reinclude2.h -include-pch %t1 -emit-pch -o %t2 // RUN: %clang_cc1 %s -include-pch %t2 -fsyntax-only -verify // expected-no-diagnostics int q2 = A::y;
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cmdline-include1.h
enum { x1 };
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/typo.cpp
// Without PCH // RUN: %clang_cc1 -include %S/Inputs/typo.hpp -verify %s // With PCH // RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/Inputs/typo.hpp // RUN: %clang_cc1 -include-pch %t -verify %s adjacent_list<int, int> g; // expected-error@-1{{no template named 'adjacent_list'; did you mean 'boost::graph::adjacency_list'?}} // expected-note@Inputs/typo.hpp:5{{'boost::graph::adjacency_list' declared here}} Function<int(int)> f; // expected-error@-1{{no template named 'Function'; did you mean 'boost::function'?}} // expected-note@Inputs/typo.hpp:2{{'boost::function' declared here}}
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cmdline-include2.h
enum { x2 };
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx1y-deduced-return-type.cpp
// No PCH: // RUN: %clang_cc1 -pedantic -std=c++1y -include %s -include %s -verify %s // // With chained PCH: // RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t.a // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.a -emit-pch %s -o %t.b // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t.b -verify %s // expected-no-diagnostics #if !defined(HEADER1) #define HEADER1 auto &f(int &); template<typename T> decltype(auto) g(T &t) { return f(t); } #elif !defined(HEADER2) #define HEADER2 // Ensure that this provides an update record for the type of HEADER1's 'f', // so that HEADER1's 'g' can successfully call it. auto &f(int &n) { return n; } #else int n; int &k = g(n); #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/thread-local.cpp
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -triple x86_64-linux-gnu -emit-pch %s -o %t // RUN: %clang_cc1 -pedantic-errors -std=c++11 -triple x86_64-linux-gnu -include-pch %t -verify %s // REQUIRES: x86-registered-target #ifndef HEADER_INCLUDED #define HEADER_INCLUDED extern thread_local int a; extern _Thread_local int b; extern int c; #else _Thread_local int a; // expected-error {{thread-local declaration of 'a' with static initialization follows declaration with dynamic initialization}} // expected-note@7 {{previous declaration is here}} thread_local int b; // expected-error {{thread-local declaration of 'b' with dynamic initialization follows declaration with static initialization}} // expected-note@8 {{previous declaration is here}} thread_local int c; // expected-error {{thread-local declaration of 'c' follows non-thread-local declaration}} // expected-note@9 {{previous declaration is here}} #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/va_arg.c
// Test this without pch. // RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include %S/va_arg.h %s -emit-llvm -o - // REQUIRES: x86-registered-target // Test with pch. // RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -emit-pch -o %t %S/va_arg.h // RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -emit-llvm -o - char *g0(char** argv, int argc) { return argv[argc]; } char *g(char **argv) { f(g0, argv, 1, 2, 3); }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-late-anonymous-namespace.cpp
// no PCH // RUN: %clang_cc1 -include %s -include %s -fsyntax-only %s // with PCH // RUN: %clang_cc1 -chain-include %s -chain-include %s -fsyntax-only %s // with PCH, with modules enabled // RUN: %clang_cc1 -chain-include %s -chain-include %s -fsyntax-only -fmodules %s #if !defined(PASS1) #define PASS1 namespace ns {} namespace os {} #elif !defined(PASS2) #define PASS2 namespace ns { namespace { extern int x; } } namespace { extern int y; } namespace { } namespace os { extern "C" { namespace { extern int z; } } } #else namespace ns { namespace { int x; } void test() { (void)x; } } namespace { int y; } void test() { (void)y; } namespace os { namespace { int z; } void test() { (void)z; } } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-variadic-templates.cpp
// Test this without pch. // RUN: %clang_cc1 -std=c++11 -include %S/cxx-variadic-templates.h -verify %s -ast-dump -o - // RUN: %clang_cc1 -std=c++11 -include %S/cxx-variadic-templates.h %s -emit-llvm -o - | FileCheck %s // Test with pch. // RUN: %clang_cc1 -std=c++11 -x c++-header -emit-pch -o %t %S/cxx-variadic-templates.h // RUN: %clang_cc1 -std=c++11 -include-pch %t -verify %s -ast-dump -o - // RUN: %clang_cc1 -std=c++11 -include-pch %t %s -emit-llvm -o - | FileCheck %s // expected-no-diagnostics // CHECK: allocate_shared shared_ptr<int> spi = shared_ptr<int>::allocate_shared(1, 2); template<int> struct A {}; template<int> struct B {}; outer<int, int>::inner<1, 2, A, B> i(A<1>{}, B<2>{});
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-trailing-return.cpp
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t-cxx11 // RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t-cxx11 -verify %s #ifndef HEADER_INCLUDED #define HEADER_INCLUDED typedef auto f() -> int; typedef int g(); #else typedef void f; // expected-error {{typedef redefinition with different types ('void' vs 'auto () -> int')}} // expected-note@7 {{here}} typedef void g; // expected-error {{typedef redefinition with different types ('void' vs 'int ()')}} // expected-note@8 {{here}} #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-typeid.h
// Header for PCH test cxx-typeid.cpp #ifndef CXX_TYPEID_H #define CXX_TYPEID_H namespace std { class type_info { public: virtual ~type_info(); bool operator==(const type_info& rhs) const; bool operator!=(const type_info& rhs) const; bool before(const type_info& rhs) const; unsigned long hash_code() const; const char* name() const; type_info(const type_info& rhs); type_info& operator=(const type_info& rhs); }; class bad_cast { public: bad_cast(); bad_cast(const bad_cast&); bad_cast& operator=(const bad_cast&); virtual const char* what() const; }; class bad_typeid { public: bad_typeid(); bad_typeid(const bad_typeid&); bad_typeid& operator=(const bad_typeid&); virtual const char* what() const; }; } // std #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-cxx.cpp
// Test C++ chained PCH functionality // Without PCH // RUN: %clang_cc1 -fsyntax-only -verify -include %s -include %s %s // With PCH // RUN: %clang_cc1 -fsyntax-only -verify %s -chain-include %s -chain-include %s // With modules // RUN: %clang_cc1 -fsyntax-only -verify -fmodules %s -chain-include %s -chain-include %s // expected-no-diagnostics #ifndef HEADER1 #define HEADER1 //===----------------------------------------------------------------------===// // Primary header for C++ chained PCH test void f(); // Name not appearing in dependent void pf(); namespace ns { void g(); void pg(); } template <typename T> struct S { typedef int G; }; // Partially specialize template <typename T> struct S<T *> { typedef int H; }; template <typename T> struct TS2; typedef TS2<int> TS2int; template <typename T> struct TestBaseSpecifiers { }; template<typename T> struct TestBaseSpecifiers2 : TestBaseSpecifiers<T> { }; template <typename T> struct TS3 { static const int value = 0; static const int value2; }; template <typename T> const int TS3<T>::value; template <typename T> const int TS3<T>::value2 = 1; // Instantiate struct, but not value. struct instantiate : TS3<int> {}; // Typedef typedef int Integer; //===----------------------------------------------------------------------===// #elif not defined(HEADER2) #define HEADER2 #if !defined(HEADER1) #error Header inclusion order messed up #endif //===----------------------------------------------------------------------===// // Dependent header for C++ chained PCH test // Overload function from primary void f(int); // Add function with different name void f2(); // Reopen namespace namespace ns { // Overload function from primary void g(int); // Add different name void g2(); } // Specialize template from primary template <> struct S<int> { typedef int I; }; // Partially specialize template <typename T> struct S<T &> { typedef int J; }; // Specialize previous partial specialization template <> struct S<int *> { typedef int K; }; // Specialize the partial specialization from this file template <> struct S<int &> { typedef int L; }; template <typename T> struct TS2 { }; struct TestBaseSpecifiers3 { }; struct TestBaseSpecifiers4 : TestBaseSpecifiers3 { }; struct A { }; struct B : A { }; // Instantiate TS3's members. static const int ts3m1 = TS3<int>::value; extern int arr[TS3<int>::value2]; // Redefinition of typedef typedef int Integer; //===----------------------------------------------------------------------===// #else //===----------------------------------------------------------------------===// void test() { f(); f(1); pf(); f2(); ns::g(); ns::g(1); ns::pg(); ns::g2(); typedef S<double>::G T1; typedef S<double *>::H T2; typedef S<int>::I T3; typedef S<double &>::J T4; typedef S<int *>::K T5; typedef S<int &>::L T6; TS2int ts2; B b; Integer i = 17; } // Should have remembered that there is a definition. static const int ts3m2 = TS3<int>::value; int arr[TS3<int>::value2]; //===----------------------------------------------------------------------===// #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx1y-decltype-auto.cpp
// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t // RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s #ifndef HEADER_INCLUDED #define HEADER_INCLUDED template<typename T> void f(T t) { auto a = t.x; decltype(auto) b = t.x; auto c = (t.x); decltype(auto) d = (t.x); } #else struct Z { int x : 5; // expected-note {{bit-field}} }; // expected-error@12 {{non-const reference cannot bind to bit-field 'x'}} template void f(Z); // expected-note {{in instantiation of}} #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-macro.c
// RUN: %clang_cc1 -emit-pch -o %t1 -detailed-preprocessing-record %S/Inputs/chain-macro1.h // RUN: %clang_cc1 -emit-pch -o %t2 -detailed-preprocessing-record %S/Inputs/chain-macro2.h -include-pch %t1 // RUN: %clang_cc1 -fsyntax-only -verify -include-pch %t2 %s // RUN: %clang_cc1 -ast-print -include-pch %t2 %s | FileCheck %s // expected-no-diagnostics // CHECK: void f(); FOOBAR // CHECK: void g(); BARFOO
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/objc_boxable_record_attr.h
// used with objc_boxable.m test typedef struct __attribute((objc_boxable)) boxable boxable;
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx_exprs.cpp
// Test this without pch. // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include %S/cxx_exprs.h -std=c++11 -fsyntax-only -verify %s -ast-dump // Test with pch. Use '-ast-dump' to force deserialization of function bodies. // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -x c++-header -std=c++11 -emit-pch -o %t %S/cxx_exprs.h // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-dump // expected-no-diagnostics int integer; double floating; char character; bool boolean; // CXXStaticCastExpr static_cast_result void_ptr = &integer; // CXXDynamicCastExpr Derived *d; dynamic_cast_result derived_ptr = d; // CXXReinterpretCastExpr reinterpret_cast_result void_ptr2 = &integer; // CXXConstCastExpr const_cast_result char_ptr = &character; // CXXFunctionalCastExpr functional_cast_result *double_ptr = &floating; // CXXBoolLiteralExpr bool_literal_result *bool_ptr = &boolean; static_assert(true_value, "true_value is true"); static_assert(!false_value, "false_value is false"); // CXXNullPtrLiteralExpr cxx_null_ptr_result null_ptr = nullptr; // CXXTypeidExpr typeid_result1 typeid_1 = 0; typeid_result2 typeid_2 = 0; // CharacterLiteral variants static_assert(char_value == 97, "char_value is correct"); static_assert(wchar_t_value == 305, "wchar_t_value is correct"); static_assert(char16_t_value == 231, "char16_t_value is correct"); static_assert(char32_t_value == 8706, "char32_t_value is correct");
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/multiple-include-pch.c
// RUN: %clang_cc1 -emit-pch -o %t1.pch %s // RUN: %clang_cc1 -emit-pch -o %t2.pch %s // RUN: %clang_cc1 %s -include-pch %t1.pch -include-pch %t2.pch -verify #ifndef HEADER #define HEADER extern int x; #else #warning parsed this // expected-warning@-1 {{parsed this}} int foo() { return x; } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-ms-function-specialization-class-scope.cpp
// REQUIRES: x86-registered-target // RUN: %clang_cc1 -fms-extensions -triple i386-unknown-unknown -x c++-header -emit-pch -o %t %S/cxx-ms-function-specialization-class-scope.h // RUN: %clang_cc1 -fms-extensions -triple i386-unknown-unknown -include-pch %t -fsyntax-only -verify %s // expected-no-diagnostics void test2() { B<char> b(3); char* ptr; b.f(ptr); b.f<int>(99); b.f(100); }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/designated-init.c
// Test this without pch. // RUN: %clang_cc1 %s -include %s.h -emit-llvm -o %t.withoutpch.ll // Test with pch. // RUN: %clang_cc1 %s.h -emit-pch -o %t.pch // RUN: %clang_cc1 %s -include-pch %t.pch -emit-llvm -o %t.withpch.ll // RUN: diff %t.withoutpch.ll %t.withpch.ll
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/implicitly-deleted.cpp
// RUN: %clang_cc1 -std=c++11 -x c++-header %s -emit-pch -o %t.pch // RUN: %clang_cc1 -std=c++11 -x c++ /dev/null -include-pch %t.pch class move_only { move_only(const move_only&) = delete; move_only(move_only&&); }; struct sb { move_only il; sb(); sb(sb &&); }; template<typename T> T make(); template<typename T> void doit(decltype(T(make<const T&>()))*) { T(make<const T&>()); } template<typename T> void doit(...) { T(make<T&&>()); } template<typename T> void later() { doit<T>(0); } void fn1() { sb x; later<sb>(); }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx11-enum-template.cpp
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t // RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t -verify %s #ifndef HEADER_INCLUDED #define HEADER_INCLUDED template<typename T> struct S { enum class E { e = T() }; }; S<int> a; S<long>::E b; S<double>::E c; template struct S<char>; #else int k1 = (int)S<int>::E::e; int k2 = (int)decltype(b)::e; int k3 = (int)decltype(c)::e; // expected-error@10 {{conversion from 'double' to 'int'}} expected-note {{here}} int k4 = (int)S<char>::E::e; #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-friends.cpp
// Test this without pch. // RUN: %clang_cc1 -include %S/cxx-friends.h -fsyntax-only -verify %s // Test with pch. // RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-friends.h // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s -error-on-deserialized-decl doNotDeserialize // Test with modules. // RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-friends.h -fmodules // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s -error-on-deserialized-decl doNotDeserialize -fmodules // expected-no-diagnostics class F { void m() { A* a; a->x = 0; } }; template<typename T> class PR12585::future_base::setter { public: int f() { return promise<T*>().k; } }; int k = PR12585::future_base::setter<int>().f(); Lazy::S *p;
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/objc_exprs.h
@protocol foo; @class itf; // Expressions typedef typeof(@"foo" "bar") objc_string; typedef typeof(@encode(int)) objc_encode; typedef typeof(@protocol(foo)) objc_protocol; typedef typeof(@selector(noArgs)) objc_selector_noArgs; typedef typeof(@selector(oneArg:)) objc_selector_oneArg; typedef typeof(@selector(foo:bar:)) objc_selector_twoArg; // Types. typedef typeof(id<foo>) objc_id_protocol_ty; typedef typeof(itf*) objc_interface_ty; typedef typeof(itf<foo>*) objc_qual_interface_ty; @interface PP @property (assign) id prop; @end static inline id getPseudoObject(PP *p) { return p.prop; }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/builtins.c
// Test this without pch. // RUN: %clang_cc1 -include %S/builtins.h -fsyntax-only -verify %s // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t %S/builtins.h // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s // expected-no-diagnostics void hello() { printf("Hello, World!"); }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-staticvar-instantiation.cpp
// Without PCH // RUN: %clang_cc1 -fsyntax-only -verify -include %s -include %s %s // With PCH // RUN: %clang_cc1 -fsyntax-only -verify %s -chain-include %s -chain-include %s #ifndef HEADER1 #define HEADER1 //===----------------------------------------------------------------------===// namespace NS { template <class _Tp, _Tp __v> struct TS { static const _Tp value = __v; }; template <class _Tp, _Tp __v> const _Tp TS<_Tp, __v>::value; TS<int, 2> g1; } //===----------------------------------------------------------------------===// #elif not defined(HEADER2) #define HEADER2 #if !defined(HEADER1) #error Header inclusion order messed up #endif int g2 = NS::TS<int, 2>::value; //===----------------------------------------------------------------------===// #else //===----------------------------------------------------------------------===// // expected-warning@+1 {{reached main file}} #warning reached main file int g3 = NS::TS<int, 2>::value; //===----------------------------------------------------------------------===// #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-using.h
// Header for PCH test cxx-using.cpp struct B { void f(char c); }; struct D : B { using B::f; void f(int); };
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/stmt-attrs.cpp
// RUN: %clang_cc1 -std=c++11 -emit-pch -o %t.a %s // RUN: %clang_cc1 -std=c++11 -include-pch %t.a %s -ast-print -o - | FileCheck %s #ifndef HEADER #define HEADER inline void test(int i) { switch (i) { case 1: // Notice that the NullStmt has two attributes. // CHECK: {{\[\[clang::fallthrough\]\] \[\[clang::fallthrough\]\]}} [[clang::fallthrough]] [[clang::fallthrough]]; case 2: break; } } #else void foo(void) { test(1); } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/headermap.h
/* Helper for the headermap.m test */ int x = 17;
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/empty-with-headers.c
// RUN: %clang_cc1 -fsyntax-only -std=c99 -pedantic-errors %s // RUN: %clang_cc1 -fsyntax-only -std=c99 -emit-pch -o %t %s // RUN: %clang_cc1 -fsyntax-only -std=c99 -pedantic-errors -include-pch %t %s // RUN: %clang_cc1 -fsyntax-only -std=c99 -pedantic-errors -DINCLUDED %s -verify // This last one should warn for -Wempty-translation-unit (C99 6.9p1). #if defined(INCLUDED) // empty except for the prefix header #elif defined(HEADER) typedef int my_int; #define INCLUDED #else #define HEADER #include "empty-with-headers.c" // empty except for the header #endif // This should only fire if the header is not included, // either explicitly or as a prefix header. // expected-error{{ISO C requires a translation unit to contain at least one declaration}}
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/objc_import.h
/* For use with the objc_import.m test */ @interface TestPCH + alloc; - (void)instMethod; @end @class NewID1; @compatibility_alias OldID1 NewID1; @class OldID1; @class OldID1; @class NewID2; @compatibility_alias OldID2 NewID2; @class OldID2; @interface OldID2 -(void)meth; @end
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-predecl.h
// First header for chain-predecl.m @class Foo; @protocol Pro;
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-offsetof-base.h
// Header for PCH test cxx-offsetof-base.cpp struct Base { int x; }; struct Derived : Base { int y; }; int o = __builtin_offsetof(Derived, x);
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/debug-info-limited-struct.c
// RUN: %clang_cc1 -emit-pch -o %t %S/debug-info-limited-struct.h // RUN: %clang_cc1 -include-pch %t -emit-llvm %s -g -o - | FileCheck %s // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo" // CHECK-NOT: flags: {{[^,]*}}FlagFwdDecl // CHECK-SAME: {{$}}
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/va_arg.h
// Header for PCH test va_arg.c typedef __builtin_va_list va_list; char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; s = g (p, __builtin_va_arg(v, int)); }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-using.cpp
// Test this without pch. // RUN: %clang_cc1 -include %S/cxx-using.h -fsyntax-only -verify %s // Test with pch. // RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-using.h // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s void m() { D s; s.f(); // expected-error {{no matching member}} } // [email protected]:9 {{candidate function}} // [email protected]:15 {{candidate function}}
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx11-constexpr.cpp
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t // RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t -verify %s #ifndef HEADER_INCLUDED #define HEADER_INCLUDED struct B { B(); constexpr B(char) {} }; struct C { B b; double d = 0.0; }; struct D : B { constexpr D(int n) : B('x'), k(2*n+1) {} int k; }; constexpr int value = 7; template<typename T> constexpr T plus_seven(T other) { return value + other; } #else static_assert(D(4).k == 9, ""); constexpr int f(C c) { return 0; } // expected-error {{not a literal type}} // expected-note@13 {{not an aggregate and has no constexpr constructors}} constexpr B b; // expected-error {{constant expression}} expected-note {{non-constexpr}} // expected-note@9 {{here}} static_assert(plus_seven(3) == 10, ""); #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/nonvisible-external-defs.c
// Test this without pch. // RUN: %clang_cc1 -include %S/nonvisible-external-defs.h -fsyntax-only -verify %s // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t %S/nonvisible-external-defs.h // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s int g(int, float); // expected-error{{conflicting types}} // [email protected]:10{{previous declaration}}
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-ms-function-specialization-class-scope.h
template <class T> class B { public: template <class U> B(U p) { } template <> B(int p) { // expected-warning{{explicit specialization of 'B<T>' within class scope is a Microsoft extension}} } template <class U> void f(U p) { T y = 9; } template <> void f(int p) { // expected-warning{{explicit specialization of 'f' within class scope is a Microsoft extension}} T a = 3; } void f(int p) { T a = 3; } };
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-traits.cpp
// Test this without pch. // RUN: %clang_cc1 -fms-extensions -include %S/cxx-traits.h -std=c++11 -fsyntax-only -verify %s // RUN: %clang_cc1 -fms-extensions -x c++-header -std=c++11 -emit-pch -o %t %S/cxx-traits.h // RUN: %clang_cc1 -fms-extensions -std=c++11 -include-pch %t -DPCH -fsyntax-only -verify %s #ifdef PCH // expected-no-diagnostics #endif bool _Is_pod_comparator = n::__is_pod<int>::__value; bool _Is_empty_check = n::__is_empty<int>::__value; bool default_construct_int = n::is_trivially_constructible<int>::value; bool copy_construct_int = n::is_trivially_constructible<int, const int&>::value; // The built-ins should still work too: bool _is_abstract_result = __is_abstract(int); bool _is_arithmetic_result = __is_arithmetic(int); bool _is_array_result = __is_array(int); bool _is_base_of_result = __is_base_of(int, int); bool _is_class_result = __is_class(int); bool _is_complete_type_result = __is_complete_type(int); bool _is_compound_result = __is_compound(int); bool _is_const_result = __is_const(int); bool _is_constructible_result = __is_constructible(int); bool _is_convertible_result = __is_convertible(int, int); bool _is_convertible_to_result = __is_convertible_to(int, int); bool _is_destructible_result = __is_destructible(int); bool _is_empty_result = __is_empty(int); bool _is_enum_result = __is_enum(int); bool _is_floating_point_result = __is_floating_point(int); bool _is_final_result = __is_final(int); bool _is_function_result = __is_function(int); bool _is_fundamental_result = __is_fundamental(int); bool _is_integral_result = __is_integral(int); bool _is_interface_class_result = __is_interface_class(int); bool _is_literal_result = __is_literal(int); bool _is_lvalue_expr_result = __is_lvalue_expr(0); bool _is_lvalue_reference_result = __is_lvalue_reference(int); bool _is_member_function_pointer_result = __is_member_function_pointer(int); bool _is_member_object_pointer_result = __is_member_object_pointer(int); bool _is_member_pointer_result = __is_member_pointer(int); bool _is_nothrow_assignable_result = __is_nothrow_assignable(int, int); bool _is_nothrow_constructible_result = __is_nothrow_constructible(int); bool _is_nothrow_destructible_result = __is_nothrow_destructible(int); bool _is_object_result = __is_object(int); bool _is_pod_result = __is_pod(int); bool _is_pointer_result = __is_pointer(int); bool _is_polymorphic_result = __is_polymorphic(int); bool _is_reference_result = __is_reference(int); bool _is_rvalue_expr_result = __is_rvalue_expr(0); bool _is_rvalue_reference_result = __is_rvalue_reference(int); bool _is_same_result = __is_same(int, int); bool _is_scalar_result = __is_scalar(int); bool _is_sealed_result = __is_sealed(int); bool _is_signed_result = __is_signed(int); bool _is_standard_layout_result = __is_standard_layout(int); bool _is_trivial_result = __is_trivial(int); bool _is_trivially_assignable_result = __is_trivially_assignable(int, int); bool _is_trivially_constructible_result = __is_trivially_constructible(int); bool _is_trivially_copyable_result = __is_trivially_copyable(int); bool _is_union_result = __is_union(int); bool _is_unsigned_result = __is_unsigned(int); bool _is_void_result = __is_void(int); bool _is_volatile_result = __is_volatile(int);
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/local_static.cpp
// REQUIRES: x86-registered-target // Test this without PCH. // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -include %S/local_static.h -fsyntax-only %s -emit-llvm -o %t.no_pch.ll %s // RUN: FileCheck --input-file %t.no_pch.ll %s // Test with PCH. // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -x c++-header -emit-pch -o %t.pch %S/local_static.h // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -include-pch %t.pch -emit-llvm -o %t.pch.ll %s // RUN: FileCheck --input-file %t.pch.ll %s void test(Bar &b) { b.f<int>(); static int s; } // Check if the mangling of static and local extern variables // are correct and preserved by PCH. // CHECK: @_ZZ4testR3BarE1s = internal global i32 0, align 4 // CHECK: @_ZZN3Bar1fIiEEvvE1y = linkonce_odr constant i32 0, align 4
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-for-range.cpp
// Test this without pch. // RUN: %clang_cc1 -x c++ -std=c++11 -include %S/cxx-for-range.h -fsyntax-only -emit-llvm -o - %s // Test with pch. // RUN: %clang_cc1 -x c++ -std=c++11 -emit-pch -o %t %S/cxx-for-range.h // RUN: %clang_cc1 -x c++ -std=c++11 -include-pch %t -fsyntax-only -emit-llvm -o - %s void h() { f(); g<int>(); char a[3] = { 0, 1, 2 }; for (auto w : a) for (auto x : S()) for (auto y : T()) for (auto z : U()) ; }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/objc_stmts.h
/* For use with the methods.m test */ @interface A @end @interface B @end @interface TestPCH - (void)instMethod; @end @implementation TestPCH - (void)instMethod { @try { } @catch(A *a) { } @catch(B *b) { } @catch(...) { } @finally { } } @end
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/variables.h
// RUN: %clang_cc1 -emit-pch -o variables.h.pch variables.h // Do not mess with the whitespace in this file. It's important. extern float y; extern int *ip, x; float z; int z2 = 17; #define MAKE_HAPPY(X) X##Happy int MAKE_HAPPY(Very); #define A_MACRO_IN_THE_PCH 492 #define FUNCLIKE_MACRO(X, Y) X ## Y #define PASTE2(x,y) x##y #define PASTE1(x,y) PASTE2(x,y) #define UNIQUE(x) PASTE1(x,__COUNTER__) int UNIQUE(a); // a0 int UNIQUE(a); // a1
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/designated-init.c.h
static void *FooToken = &FooToken; static void *FooTable[256] = { [0x3] = (void *[256]) { // 1 [0x5b] = (void *[256]) { // 2 [0x81] = (void *[256]) { // 3 [0x42] = (void *[256]) { // 4 [0xa2] = (void *[256]) { // 5 [0xe] = (void *[256]) { // 6 [0x20] = (void *[256]) { // 7 [0xd7] = (void *[256]) { // 8 [0x39] = (void *[256]) { // 9 [0xf1] = (void *[256]) { // 10 [0xa4] = (void *[256]) { // 11 [0xa8] = (void *[256]) { // 12 [0x21] = (void *[256]) { // 13 [0x86] = (void *[256]) { // 14 [0x1d] = (void *[256]) { // 15 [0xdc] = (void *[256]) { // 16 [0xa5] = (void *[256]) { // 17 [0xef] = (void *[256]) { // 18 [0x9] = (void *[256]) { // 19 [0x34] = &FooToken, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, } }; struct P1 { struct Q1 { char a[6]; char b[6]; } q; }; struct P1 l1 = { (struct Q1){ "foo", "bar" }, .q.b = { "boo" }, .q.b = { [1] = 'x' } }; extern struct Q1 *foo(); static struct P1 test_foo() { struct P1 l = { *foo(), .q.b = { "boo" }, .q.b = { [1] = 'x' } }; return l; }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/macro-undef.cpp
// RUN: %clang_cc1 -emit-pch -o %t %s // RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -verify // RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s #ifndef HEADER #define HEADER #define NULL 0 template<typename T> void *f() { void *p; // @11 return p; // @12 } #undef NULL template<typename T> void *g() { void *p; // @17 return p; // @18 } #else // expected-warning@12 {{uninitialized}} // expected-note@11 {{initialize}} // CHECK: fix-it:"{{.*}}":{11:10-11:10}:" = NULL" // expected-warning@18 {{uninitialized}} // expected-note@17 {{initialize}} // CHECK: fix-it:"{{.*}}":{17:10-17:10}:" = 0" int main() { f<int>(); // expected-note {{instantiation}} g<int>(); // expected-note {{instantiation}} } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-trivial.c
// REQUIRES: x86-registered-target // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t1 %S/Inputs/chain-trivial1.h // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t2 -include-pch %t1 %S/Inputs/chain-trivial2.h
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/ext_vector.c
// Test this without pch. // RUN: %clang_cc1 -include %S/ext_vector.h -fsyntax-only -verify %s // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t %S/ext_vector.h // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s int test(float4 f4) { return f4.xy; // expected-error{{float2}} }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/typo2.cpp
// RUN: %clang_cc1 -emit-pch %s -o %t.pch // RUN: %clang_cc1 -include-pch %t.pch %s -verify #ifndef HEADER_INCLUDED #define HEADER_INCLUDED void func(struct Test); #else ::Yest *T; // expected-error{{did you mean 'Test'}} // expected-note@7{{'Test' declared here}} #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-typeid.cpp
// Test this without pch. // RUN: %clang_cc1 -include %S/cxx-typeid.h -fsyntax-only -stdlib=libstdc++ -verify %s // RUN: %clang_cc1 -x c++-header -emit-pch -stdlib=libstdc++ -o %t.pch %S/cxx-typeid.h // RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only -stdlib=libstdc++ -verify %s // expected-no-diagnostics void f() { (void)typeid(int); }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/multiple_decls.h
// Header for PCH test multiple_decls.c struct wide { int value; }; int wide(char); struct narrow { char narrow; }; char narrow(int);
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/ms-if-exists.cpp
// RUN: %clang_cc1 -x c++ -fms-extensions -fsyntax-only -emit-pch -o %t %s // RUN: %clang_cc1 -x c++ -fms-extensions -fsyntax-only -include-pch %t %s -verify #ifndef HEADER #define HEADER template<typename T> void f(T t) { __if_exists(T::foo) { { } t.foo(); } __if_not_exists(T::bar) { int *i = t; { } } } #else struct HasFoo { void foo(); }; struct HasBar { void bar(int); void bar(float); }; template void f(HasFoo); // expected-note{{in instantiation of function template specialization 'f<HasFoo>' requested here}} // expected-error@14{{no viable conversion from 'HasFoo' to 'int *'}} template void f(HasBar); #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/check-deserializations.cpp
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-pch -o %t.1 %s // RUN: %clang_cc1 -triple x86_64-linux-gnu -error-on-deserialized-decl S1_keyfunc -error-on-deserialized-decl S3 -include-pch %t.1 -emit-pch -o %t.2 %s // RUN: %clang_cc1 -triple x86_64-linux-gnu -error-on-deserialized-decl S1_method -error-on-deserialized-decl S3 -include-pch %t.2 -emit-llvm-only %s // FIXME: Why does this require an x86 target? // REQUIRES: x86-registered-target #ifndef HEADER1 #define HEADER1 // Header. struct S1 { void S1_method(); virtual void S1_keyfunc(); }; struct S3 {}; struct S2 { operator S3(); }; #elif !defined(HEADER2) #define HEADER2 // Chained PCH. S1 *s1; S2 *s2; #else // Using the headers. void test(S1*, S2*) { } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-implicit-definition.cpp
// no PCH // RUN: %clang_cc1 -emit-llvm-only -include %s -include %s %s // with PCH // RUN: %clang_cc1 -emit-llvm-only -chain-include %s -chain-include %s %s #if !defined(PASS1) #define PASS1 // A base with a virtual dtor. struct A { virtual ~A(); }; // A derived class with an implicit virtual dtor. struct B : A { // Key function to suppress vtable definition. virtual void virt(); }; #elif !defined(PASS2) #define PASS2 // Further derived class that requires ~B(). // Causes definition of ~B(), but it was lost when saving PCH. struct C : B { C(); ~C() {} }; #else void foo() { // Variable that requires ~C(). C c; } // VTable placement would again cause definition of ~B(), hiding the bug, // if not for B::virt(), which suppresses the placement. #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/stmts.c
// Test this without pch. // RUN: %clang_cc1 -include %S/stmts.h -fsyntax-only -emit-llvm -o - %s // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t %S/stmts.h // RUN: %clang_cc1 -include-pch %t -fsyntax-only -emit-llvm -o - %s void g0(void) { f0(5); } int g1(int x) { return f1(x); } const char* query_name(void) { return what_is_my_name(); } int use_computed_goto(int x) { return computed_goto(x); } int get_weird_max(int x, int y) { return weird_max(x, y); }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/nonvisible-external-defs.h
// Helper for PCH test nonvisible-external-defs.h void f() { extern int g(int, int); }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/macro-redef.c
// RUN: %clang_cc1 %s -emit-pch -o %t1.pch -verify // RUN: %clang_cc1 %s -emit-pch -o %t2.pch -include-pch %t1.pch -verify // RUN: %clang_cc1 -fsyntax-only %s -include-pch %t2.pch -verify // Test that a redefinition inside the PCH won't manifest as an ambiguous macro. // rdar://13016031 #ifndef HEADER1 #define HEADER1 #define M1 0 // expected-note {{previous}} #define M1 1 // expected-warning {{redefined}} #define M2 3 #elif !defined(HEADER2) #define HEADER2 #define M2 4 // expected-warning {{redefined}} // expected-note@-6 {{previous}} #else // Use the error to verify it was parsed. int x = M1; // expected-note {{previous}} int x = M2; // expected-error {{redefinition}} #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/debug-info-limited-struct.h
struct foo { int i; }; void func() { struct foo *f; f->i = 3; }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-namespaces.h
// Header for PCH test cxx-namespaces.cpp namespace N { namespace { int x; } void f(); void f(int); }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-external-defs.c
// REQUIRES: x86-registered-target // Test with pch. // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t1.pch %S/Inputs/chain-external-defs1.h // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t2.pch %S/Inputs/chain-external-defs2.h -include-pch %t1.pch // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -include-pch %t2.pch -emit-llvm -o %t %s // RUN: echo FINI >> %t // RUN: FileCheck -input-file=%t -check-prefix=Z %s // RUN: FileCheck -input-file=%t -check-prefix=XA %s // RUN: FileCheck -input-file=%t -check-prefix=YA %s // RUN: FileCheck -input-file=%t -check-prefix=XB %s // RUN: FileCheck -input-file=%t -check-prefix=YB %s // RUN: FileCheck -input-file=%t -check-prefix=AA %s // RUN: FileCheck -input-file=%t -check-prefix=AB %s // RUN: FileCheck -input-file=%t -check-prefix=AC %s // RUN: FileCheck -input-file=%t -check-prefix=S %s // Z-NOT: @z // XA: @x = common global i32 0 // XA-NOT: @x = common global i32 0 // YA: @y = common global i32 0 // YA-NOT: @y = common global i32 0 // XB: @x2 = global i32 19 // XB-NOT: @x2 = global i32 19 int x2 = 19; // YB: @y2 = global i32 18 // YB-NOT: @y2 = global i32 18 int y2 = 18; // AA: @incomplete_array = common global [1 x i32] // AA-NOT: @incomplete_array = common global [1 x i32] // AB: @incomplete_array2 = common global [17 x i32] // AB-NOT: @incomplete_array2 = common global [17 x i32] int incomplete_array2[17]; // AC: @incomplete_array3 = common global [1 x i32] // AC-NOT: @incomplete_array3 = common global [1 x i32] int incomplete_array3[]; // S: @s = common global %struct.S // S-NOT: @s = common global %struct.S struct S { int x, y; }; // Z: FINI // XA: FINI // YA: FINI // XB: FINI // YB: FINI // AA: FINI // AB: FINI // AC: FINI // S: FINI
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/reloc.c
// RUN: %clang -target x86_64-apple-darwin10 --relocatable-pch -o %t \ // RUN: -isysroot %S/libroot %S/libroot/usr/include/reloc.h // RUN: %clang -target x86_64-apple-darwin10 -fsyntax-only \ // RUN: -include-pch %t -isysroot %S/libroot %s -Xclang -verify // RUN: not %clang -target x86_64-apple-darwin10 -include-pch %t %s // REQUIRES: x86-registered-target #include <reloc.h> int x = 2; // expected-error{{redefinition}} int y = 5; // expected-error{{redefinition}} // expected-note@libroot/usr/include/reloc.h:13{{previous definition}} // expected-note@libroot/usr/include/reloc2.h:14{{previous definition}}
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/working-directory.h
#include <Inputs/working-directory-1.h>
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/pch-dir.c
// RUN: mkdir -p %t.h.gch // RUN: %clang -x c-header %S/pch-dir.h -DFOO=foo -o %t.h.gch/c.gch // RUN: %clang -x c-header %S/pch-dir.h -DFOO=bar -o %t.h.gch/cbar.gch // RUN: %clang -x c++-header -std=c++98 %S/pch-dir.h -o %t.h.gch/cpp.gch // RUN: %clang -include %t.h -DFOO=foo -fsyntax-only %s -Xclang -print-stats 2> %t.clog // RUN: FileCheck -check-prefix=CHECK-C %s < %t.clog // RUN: %clang -include %t.h -DFOO=bar -DBAR=bar -fsyntax-only %s -Xclang -ast-print > %t.cbarlog // RUN: FileCheck -check-prefix=CHECK-CBAR %s < %t.cbarlog // RUN: %clang -x c++ -include %t.h -std=c++98 -fsyntax-only %s -Xclang -print-stats 2> %t.cpplog // RUN: FileCheck -check-prefix=CHECK-CPP %s < %t.cpplog // RUN: not %clang -x c++ -std=c++11 -include %t.h -fsyntax-only %s 2> %t.cpp11log // RUN: FileCheck -check-prefix=CHECK-CPP11 %s < %t.cpp11log // CHECK-CBAR: int bar int FOO; int get() { #ifdef __cplusplus // CHECK-CPP: .h.gch{{[/\\]}}cpp.gch return i; #else // CHECK-C: .h.gch{{[/\\]}}c.gch return j; #endif } // CHECK-CPP11: no suitable precompiled header file found in directory
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/rdar8852495.c
// Test this without pch. // RUN: %clang_cc1 %s -include %s -verify -fsyntax-only -Wno-sign-compare -Wtautological-compare // Test with pch. // RUN: %clang_cc1 %s -emit-pch -o %t -Wsign-compare -Wtautological-compare // RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only -Wno-sign-compare -Wtautological-compare // expected-no-diagnostics // This tests that diagnostic mappings from PCH are propagated for #pragma // diagnostics but not for command-line flags. #ifndef HEADER #define HEADER #pragma clang diagnostic ignored "-Wtautological-compare" #else int f() { int a; int b = a==a; unsigned x; signed y; return x == y; } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx11-user-defined-literals.cpp
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t // RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t -verify %s #ifndef HEADER_INCLUDED #define HEADER_INCLUDED using size_t = decltype(sizeof(int)); int operator"" _foo(const char *p, size_t); template<typename T> auto f(T t) -> decltype(t + ""_foo) { return 0; } #else int j = ""_foo; int k = f(0); int *l = f(&k); struct S {}; int m = f(S()); // expected-error {{no matching}} // expected-note@11 {{substitution failure}} #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-required-decls.h
// Header for PCH test cxx-required-decls.cpp struct S { S(); }; static S globS; extern int ext_foo; static int bar = ++ext_foo; int glob_var;
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-reference.cpp
// Test this without pch. // RUN: %clang_cc1 -x c++ -triple %itanium_abi_triple -std=c++11 -include %S/cxx-reference.h -fsyntax-only -emit-llvm -o - %s // Test with pch. // RUN: %clang_cc1 -x c++ -triple %itanium_abi_triple -std=c++11 -emit-pch -o %t %S/cxx-reference.h // RUN: %clang_cc1 -x c++ -triple %itanium_abi_triple -std=c++11 -include-pch %t -fsyntax-only -emit-llvm -o - %s
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/__va_list_tag.c
// REQUIRES: x86-registered-target // PR13189 // rdar://problem/11741429 // Test this without pch. // RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include %S/Inputs/__va_list_tag.h %s -emit-llvm -o - // Test with pch. // RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -emit-pch -x c-header -o %t %S/Inputs/__va_list_tag.h // RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -verify // expected-no-diagnostics int myvprintf(const char *fmt, va_list args) { return myvfprintf(fmt, args); }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/friend-template.cpp
// Test this without pch. // RUN: %clang_cc1 -include %s -fsyntax-only -verify %s // Test with pch. // RUN: %clang_cc1 -emit-pch -o %t %s // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s // expected-no-diagnostics #ifndef HEADER #define HEADER // rdar://12627738 namespace rdar12627738 { class RecyclerTag { template <typename T> friend class Recycler; }; } #else namespace rdar12627738 { template<typename TTag> class CRN { template <typename T> friend class Recycler; }; template<typename T> class Recycler { public: Recycler (); }; template<typename T> Recycler<T>::Recycler () { } } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-conversion-lookup.cpp
// RUN: %clang_cc1 %s -emit-llvm -o - -chain-include %s -chain-include %s #if !defined(PASS1) #define PASS1 struct X { operator int*(); }; struct Z { operator int*(); }; #elif !defined(PASS2) #define PASS2 struct Y { operator int *(); }; #else int main() { X x; int *ip = x.operator int*(); Y y; int *ip2 = y.operator int*(); Z z; int *ip3 = z.operator int*(); } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-traits.h
// Header for PCH test cxx-traits.cpp namespace n { template<typename _Tp> struct __is_pod { // expected-warning {{keyword '__is_pod' will be made available as an identifier for the remainder of the translation unit}} enum { __value }; }; template<typename _Tp> struct __is_empty { // expected-warning {{keyword '__is_empty' will be made available as an identifier for the remainder of the translation unit}} enum { __value }; }; template<typename T, typename ...Args> struct is_trivially_constructible { static const bool value = __is_trivially_constructible(T, Args...); }; struct __is_abstract {}; // expected-warning {{made available}} struct __is_arithmetic {}; // expected-warning {{made available}} struct __is_array {}; // expected-warning {{made available}} struct __is_base_of {}; // expected-warning {{made available}} struct __is_class {}; // expected-warning {{made available}} struct __is_complete_type {}; // expected-warning {{made available}} struct __is_compound {}; // expected-warning {{made available}} struct __is_const {}; // expected-warning {{made available}} struct __is_constructible {}; // expected-warning {{made available}} struct __is_convertible {}; // expected-warning {{made available}} struct __is_convertible_to {}; // expected-warning {{made available}} struct __is_destructible {}; // expected-warning {{made available}} struct __is_enum {}; // expected-warning {{made available}} struct __is_floating_point {}; // expected-warning {{made available}} struct __is_final {}; // expected-warning {{made available}} struct __is_function {}; // expected-warning {{made available}} struct __is_fundamental {}; // expected-warning {{made available}} struct __is_integral {}; // expected-warning {{made available}} struct __is_interface_class {}; // expected-warning {{made available}} struct __is_literal {}; // expected-warning {{made available}} struct __is_lvalue_expr {}; // expected-warning {{made available}} struct __is_lvalue_reference {}; // expected-warning {{made available}} struct __is_member_function_pointer {}; // expected-warning {{made available}} struct __is_member_object_pointer {}; // expected-warning {{made available}} struct __is_member_pointer {}; // expected-warning {{made available}} struct __is_nothrow_assignable {}; // expected-warning {{made available}} struct __is_nothrow_constructible {}; // expected-warning {{made available}} struct __is_nothrow_destructible {}; // expected-warning {{made available}} struct __is_object {}; // expected-warning {{made available}} struct __is_pointer {}; // expected-warning {{made available}} struct __is_polymorphic {}; // expected-warning {{made available}} struct __is_reference {}; // expected-warning {{made available}} struct __is_rvalue_expr {}; // expected-warning {{made available}} struct __is_rvalue_reference {}; // expected-warning {{made available}} struct __is_same {}; // expected-warning {{made available}} struct __is_scalar {}; // expected-warning {{made available}} struct __is_sealed {}; // expected-warning {{made available}} struct __is_signed {}; // expected-warning {{made available}} struct __is_standard_layout {}; // expected-warning {{made available}} struct __is_trivial {}; // expected-warning {{made available}} struct __is_trivially_assignable {}; // expected-warning {{made available}} struct __is_trivially_constructible {}; // expected-warning {{made available}} struct __is_trivially_copyable {}; // expected-warning {{made available}} struct __is_union {}; // expected-warning {{made available}} struct __is_unsigned {}; // expected-warning {{made available}} struct __is_void {}; // expected-warning {{made available}} struct __is_volatile {}; // expected-warning {{made available}} }
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-exprs.cpp
// Test this without pch. // RUN: %clang_cc1 -include %s -verify -std=c++11 %s // Test with pch. // RUN: %clang_cc1 -std=c++11 -emit-pch -o %t %s // RUN: %clang_cc1 -include-pch %t -verify -std=c++11 %s // expected-no-diagnostics #ifndef HEADER #define HEADER template<typename T> class New { New(const New&); public: New *clone() { return new New(*this); } }; #else New<int> *clone_new(New<int> *n) { return n->clone(); } #endif
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/line-directive.h
#line 25 "line-directive.c" int x;
0
repos/DirectXShaderCompiler/tools/clang/test
repos/DirectXShaderCompiler/tools/clang/test/PCH/field-designator.c
// RUN: %clang_cc1 %s -include %s // RUN: %clang_cc1 %s -emit-pch -o %t.pch // RUN: %clang_cc1 %s -include-pch %t.pch // rdar://12239321 Make sure we don't emit a bogus // error: field designator 'e' does not refer to a non-static data member #ifndef HEADER #define HEADER //===----------------------------------------------------------------------===// struct U { union { struct { int e; int f; }; int a; }; }; //===----------------------------------------------------------------------===// #else #if !defined(HEADER) # error Header inclusion order messed up #endif //===----------------------------------------------------------------------===// void bar() { static const struct U plan = { .e = 1 }; } //===----------------------------------------------------------------------===// #endif
0
repos/DirectXShaderCompiler/tools/clang/test/PCH/libroot/usr
repos/DirectXShaderCompiler/tools/clang/test/PCH/libroot/usr/include/reloc.h
#ifndef RELOC_H #define RELOC_H #include <reloc2.h> // Line number 13 below is important int x = 2; #endif // RELOC_H
0
repos/DirectXShaderCompiler/tools/clang/test/PCH/libroot/usr
repos/DirectXShaderCompiler/tools/clang/test/PCH/libroot/usr/include/reloc2.h
#ifndef RELOC2_H #define RELOC2_H #include <stddef.h> // Line number below is important! int y = 2; #endif // RELOC2_H
0
repos/DirectXShaderCompiler/tools/clang/test/PCH
repos/DirectXShaderCompiler/tools/clang/test/PCH/Inputs/preamble.h
int f(int);