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/CodeGenHLSL/Samples
|
repos/DirectXShaderCompiler/tools/clang/test/CodeGenHLSL/Samples/DX11/TessellatorCS40_defines.h
|
//--------------------------------------------------------------------------------------
// File: TessellatorCS40_defines.h
//
// This file defines common constants which are included by both CPU code and shader code
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#define MAX_FACTOR 16
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/changed-files.c
|
const char *s0 = m0;
int s1 = m1;
const char *s2 = m0;
// FIXME: This test fails inexplicably on Windows in a manner that makes it
// look like standard error isn't getting flushed properly.
// RUN: false
// XFAIL: *
// RUN: echo '#define m0 ""' > %t.h
// RUN: %clang_cc1 -emit-pch -o %t.h.pch %t.h
// RUN: echo '' > %t.h
// RUN: not %clang_cc1 -include-pch %t.h.pch %s 2> %t.stderr
// RUN: grep "modified" %t.stderr
// RUN: echo '#define m0 000' > %t.h
// RUN: %clang_cc1 -emit-pch -o %t.h.pch %t.h
// RUN: echo '' > %t.h
// RUN: not %clang_cc1 -include-pch %t.h.pch %s 2> %t.stderr
// RUN: grep "modified" %t.stderr
// RUN: echo '#define m0 000' > %t.h
// RUN: echo "#define m1 'abcd'" >> %t.h
// RUN: %clang_cc1 -emit-pch -o %t.h.pch %t.h
// RUN: echo '' > %t.h
// RUN: not %clang_cc1 -include-pch %t.h.pch %s 2> %t.stderr
// RUN: grep "modified" %t.stderr
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/target-options.c
|
// RUN: %clang_cc1 -triple=x86_64-apple-darwin9 -emit-pch -o %t.pch %S/target-options.h
// RUN: not %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include-pch %t.pch %s -emit-llvm -o - > %t.err 2>&1
// RUN: FileCheck %s < %t.err
// REQUIRES: x86-registered-target
// CHECK: for the target
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-required-decls.cpp
|
// Test this without pch.
// RUN: %clang_cc1 -include %S/cxx-required-decls.h %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
// Test with pch.
// RUN: %clang_cc1 -x c++-header -triple %itanium_abi_triple -emit-pch -o %t %S/cxx-required-decls.h
// RUN: %clang_cc1 -include-pch %t %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
// CHECK: @_ZL5globS = internal global %struct.S zeroinitializer
// CHECK: @_ZL3bar = internal global i32 0, align 4
// CHECK: @glob_var = global i32 0
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx0x-delegating-ctors.cpp
|
// Test this without pch.
// RUN: %clang_cc1 -include %s -std=c++11 -fsyntax-only -verify %s
// Test with pch.
// RUN: %clang_cc1 -x c++-header -std=c++11 -emit-pch -o %t %s
// RUN: %clang_cc1 -std=c++11 -include-pch %t -fsyntax-only -verify %s
#ifndef PASS1
#define PASS1
struct foo {
foo(int) : foo() { }
foo();
foo(bool) : foo('c') { }
foo(char) : foo(true) { }
};
#else
foo::foo() : foo(1) { } // expected-error{{creates a delegation cycle}} \
// expected-note{{which delegates to}}
// expected-note@11{{it delegates to}}
// expected-note@13{{it delegates to}}
// expected-error@14{{creates a delegation cycle}}
// expected-note@14{{which delegates to}}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/pragma-weak.h
|
// Header for PCH test pragma-weak.c
#pragma weak weakvar
#pragma weak undeclaredvar
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/method_pool.h
|
/* For use with the method_pool.m test */
/* Whitespace below is significant */
@interface TestMethodPool1
+ alloc;
- (double)instMethod:(int)foo;
@end
@interface TestMethodPool2
- (char)instMethod:(int)foo;
@end
@implementation TestMethodPool1
+ alloc { return 0; }
- (double)instMethod:(int)foo {
return foo;
}
@end
@implementation TestMethodPool2
- (char)instMethod:(int)foo {
return foo;
}
@end
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx1y-init-captures.cpp
|
// No PCH:
// RUN: %clang_cc1 -pedantic -std=c++1y -include %s -verify %s
//
// With PCH:
// 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
#define HEADER
auto counter = [a(0)] () mutable { return a++; };
int x = counter();
template<typename T> void f(T t) {
[t(t)] { int n = t; } ();
}
#else
int y = counter();
void g() {
f(0); // ok
// expected-error@15 {{lvalue of type 'const char *const'}}
f("foo"); // expected-note {{here}}
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/attrs.c
|
// 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
#ifndef HEADER
#define HEADER
int f(int) __attribute__((visibility("default"), overloadable));
#else
double f(double); // expected-error{{overloadable}}
// expected-note@11{{previous overload}}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/single-token-macro.c
|
// rdar://10588825
// Test this without pch.
// RUN: %clang_cc1 %s -include %s -verify -fsyntax-only
// Test with pch.
// RUN: %clang_cc1 %s -emit-pch -o %t
// RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only
// expected-no-diagnostics
#ifndef HEADER
#define HEADER
#ifdef __stdcall
// __stdcall is defined as __attribute__((__stdcall__)) for targeting mingw32.
#undef __stdcall
#endif
#define __stdcall
#define STDCALL __stdcall
void STDCALL Foo(void);
#else
void STDCALL Foo(void)
{
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/reinclude2.h
|
int q1 = A::x;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-mangling.cpp
|
// Test without PCH.
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -include %s %s -emit-llvm -o - | FileCheck %s
//
// Test with PCH.
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -x c++-header %s -emit-pch -o %t
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -include-pch %t %s -emit-llvm -o - | FileCheck %s
#ifndef HEADER
#define HEADER
struct A {
struct { int a; } a;
struct { int b; } b;
};
#else
template<typename T> void f(T) {}
// CHECK-LABEL: define {{.*}}void @_Z1g1A(
void g(A a) {
// CHECK: call {{.*}}void @_Z1fIN1AUt0_EEvT_(
f(a.b);
// CHECK: call {{.*}}void @_Z1fIN1AUt_EEvT_(
f(a.a);
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-pending-instantiations.cpp
|
// RUN: %clang_cc1 %s -emit-llvm -triple i686-pc-linux -o - -chain-include %s -chain-include %s | FileCheck %s
// CHECK: define linkonce_odr %{{[^ ]+}} @_ZN1AI1BE3getEv
#if !defined(PASS1)
#define PASS1
template <typename Derived>
struct A {
Derived* get() { return 0; }
};
struct B : A<B> {
};
#elif !defined(PASS2)
#define PASS2
struct C : B {
};
struct D : C {
void run() {
(void)get();
}
};
#else
int main() {
D d;
d.run();
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-method.cpp
|
// RUN: %clang_cc1 -x c++ -include %S/Inputs/cxx-method.h -verify %s
// RUN: %clang_cc1 -x c++ -emit-pch %S/Inputs/cxx-method.h -o %t
// RUN: %clang_cc1 -include-pch %t -verify %s
// expected-no-diagnostics
void S::m(int x) { }
S::operator char *() { return 0; }
S::operator const char *() { return 0; }
struct T : S {};
const T a = T();
T b(a);
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/types.h
|
/* Used with the types.c test */
// TYPE_EXT_QUAL
typedef __attribute__((address_space(1))) int ASInt;
// TYPE_COMPLEX
typedef _Complex float Cfloat;
// TYPE_ATOMIC
typedef _Atomic(int) AtomicInt;
// TYPE_POINTER
typedef int * int_ptr;
// TYPE_BLOCK_POINTER
typedef int (^Block)(int, float);
// TYPE_CONSTANT_ARRAY
typedef int five_ints[5];
// TYPE_INCOMPLETE_ARRAY
typedef float float_array[];
// TYPE_VARIABLE_ARRAY in stmts.[ch]
// TYPE_VECTOR
typedef float float4 __attribute__((vector_size(16)));
// TYPE_EXT_VECTOR
typedef float ext_float4 __attribute__((ext_vector_type(4)));
// TYPE_FUNCTION_NO_PROTO
typedef int noproto();
// TYPE_FUNCTION_PROTO
typedef float proto(float, float, ...);
// TYPE_TYPEDEF
typedef int_ptr * int_ptr_ptr;
// TYPE_TYPEOF_EXPR
typedef typeof(17) typeof_17;
// TYPE_TYPEOF
typedef typeof(int_ptr *) int_ptr_ptr2;
struct S2;
struct S2 {};
enum E;
enum E { myenum };
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/pragma-diag-section.cpp
|
// Test this without pch.
// RUN: %clang_cc1 %s -include %s -verify -fsyntax-only -Wuninitialized
// Test with pch.
// RUN: %clang_cc1 %s -emit-pch -o %t
// RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only -Wuninitialized
#ifndef HEADER
#define HEADER
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wuninitialized"
template <typename T>
struct TS1 {
void m() {
T a;
T b = a;
}
};
#pragma clang diagnostic pop
#else
template <typename T>
struct TS2 {
void m() {
T a;
T b = a; // expected-warning {{variable 'a' is uninitialized}} \
expected-note@41 {{in instantiation of member function}} \
expected-note@28 {{initialize the variable 'a' to silence}}
}
};
void f() {
TS1<int> ts1;
ts1.m();
TS2<int> ts2;
ts2.m();
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-typo-corrections.cpp
|
// RUN: %clang_cc1 -verify -chain-include %s %s
// PR 14044
#ifndef PASS1
#define PASS1
class S {
void f(struct Test);
};
#else
::Tesy *p; // expected-error {{did you mean 'Test'}}
// expected-note@-4 {{'Test' declared here}}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/stmts.h
|
// Header for PCH test stmts.c
void f0(int x) {
// NullStmt
;
// IfStmt
if (x) {
} else if (x + 1) {
}
switch (x) {
case 0:
x = 17;
break;
case 1:
break;
default:
switch (x >> 1) {
case 7:
// fall through
case 9:
break;
}
x += 2;
break;
}
while (x > 20) {
if (x > 30) {
--x;
continue;
} else if (x < 5)
break;
else
goto done;
}
do {
x++;
} while (x < 10);
almost_done:
for (int y = x; y < 20; ++y) {
if (x + y == 12)
return;
else if (x - y == 7)
goto almost_done;
}
done:
x = x + 2;
int z = x, *y, j = 5;
}
int f1(int x) {
switch (x) {
case 17:
return 12;
default:
break;
}
// variable-length array
int array[x * 17 + 3];
return x*2;
}
const char* what_is_my_name(void) { return __func__; }
int computed_goto(int x) {
start:
x = x << 1;
void *location = &&start;
if (x > 17)
location = &&done;
while (x > 12) {
--x;
if (x == 15)
goto *location;
}
done:
return 5;
}
#define maxint(a,b) ({int _a = (a), _b = (b); _a > _b ? _a : _b; })
int weird_max(int x, int y) {
return maxint(++x, --y);
}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/external-defs.c
|
// REQUIRES: x86-registered-target
// Test with pch.
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t.pch %S/external-defs.h
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -include-pch %t.pch -emit-llvm -o %t %s
// RUN: grep "@x = common global i32 0" %t | count 1
// RUN: not grep "@z" %t
// RUN: grep "@x2 = global i32 19" %t | count 1
int x2 = 19;
// RUN: grep "@incomplete_array = common global .*1 x i32" %t | count 1
// RUN: grep "@incomplete_array2 = common global .*17 x i32" %t | count 1
int incomplete_array2[17];
// RUN: grep "@incomplete_array3 = common global .*1 x i32" %t | count 1
int incomplete_array3[];
struct S {
int x, y;
};
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-for-range.h
|
// Header for PCH test cxx-for-range.cpp
struct S {
int *begin();
int *end();
};
struct T { };
char *begin(T);
char *end(T);
namespace NS {
struct U { };
char *begin(U);
char *end(U);
}
using NS::U;
void f() {
char a[3] = { 0, 1, 2 };
for (auto w : a)
for (auto x : S())
for (auto y : T())
for (auto z : U())
;
}
template<typename A>
void g() {
A a[3] = { 0, 1, 2 };
for (auto &v : 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/objcxx-ivar-class.h
|
struct S {
S();
S(const S&);
~S();
S& operator= (const S&);
};
@interface C {
S position;
}
@property(assign, nonatomic) S position;
@end
@implementation C
@synthesize position;
@end
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/source-manager-stack.c
|
// Test that the source manager has the "proper" idea about the include stack
// when using PCH.
// RUN: echo 'int x;' > %t.prefix.h
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-show-note-include-stack -include %t.prefix.h %s 2> %t.diags.no_pch.txt
// RUN: %clang_cc1 -emit-pch -o %t.prefix.pch %t.prefix.h
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-show-note-include-stack -include-pch %t.prefix.pch %s 2> %t.diags.pch.txt
// RUN: diff %t.diags.no_pch.txt %t.diags.pch.txt
// XFAIL: *
// PR5662
float x;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/pchpch.c
|
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-pch -o %t1 %S/pchpch1.h
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-pch -o %t2 %S/pchpch2.h -include-pch %t1
// RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only %s -include-pch %t2
// REQUIRES: x86-registered-target
// The purpose of this test is to make sure that a PCH created while including
// an existing PCH can be loaded.
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/tentative-defs.h
|
// Header for PCH test tentative-defs.c
int variable;
int incomplete_array[];
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-macro-override.c
|
// Test this without pch.
// RUN: %clang_cc1 -include %S/Inputs/chain-macro-override1.h -include %S/Inputs/chain-macro-override2.h -fsyntax-only -verify -detailed-preprocessing-record %s
// Test with pch.
// RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-macro-override1.h -detailed-preprocessing-record
// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-macro-override2.h -include-pch %t1 -detailed-preprocessing-record
// RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s
int foo() {
f();
g();
h();
h2(); // expected-warning{{implicit declaration of function 'h2' is invalid in C99}}
h3();
return x;
}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-alias-decl.h
|
// Header for PCH test cxx-alias-decl.cpp
struct S {};
template<typename U> struct T {
template<typename V> using A = T<V>;
};
using A = int;
template<typename U> using B = S;
template<typename U> using C = T<U>;
template<typename U, typename V> using D = typename T<U>::template A<V>;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/tentative-defs.c
|
// Test with pch.
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t.pch %S/tentative-defs.h
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -include-pch %t.pch -verify -emit-llvm -o %t %s
// REQUIRES: x86-registered-target
// RUN: grep "@variable = common global i32 0" %t | count 1
// RUN: grep "@incomplete_array = common global .*1 x i32" %t | count 1
// FIXME: [email protected]:9{{tentative}}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/local_static.h
|
class Bar {
public:
template<typename T>
void f() {
static const T y = 0;
}
};
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/undefined-internal.c
|
// RUN: %clang_cc1 -emit-pch %s -o %t
// RUN: %clang_cc1 -include-pch %t %s -verify
#ifndef HEADER_H
#define HEADER_H
static void f();
static void g();
void h() {
f();
g();
}
#else
static void g() {}
// expected-warning@5{{function 'f' has internal linkage but is not defined}}
// expected-note@8{{used here}}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/blocks.h
|
// Header for PCH test blocks.c
int call_block(int (^bl)(int x, int y), int a, int b) {
return bl(a, b);
}
int add(int a, int b) {
return call_block(^(int x, int y) { return x + y; }, a, b);
}
int scaled_add(int a, int b, int s) {
__block int scale = s;
return call_block(^(int x, int y) { return x*scale + y; }, a, b);
}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/crash-12631281.cpp
|
// RUN: %clang_cc1 -std=c++11 %s -emit-pch -o %t.pch
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -include-pch %t.pch -verify
// expected-no-diagnostics
// rdar://12631281
// This reduced test case exposed a use-after-free memory bug, which was reliable
// reproduced only on guarded malloc (and probably valgrind).
#ifndef HEADER
#define HEADER
template < class _T2> struct is_convertible;
template <> struct is_convertible<int> { typedef int type; };
template <class _T1, class _T2> struct pair {
typedef _T1 first_type;
typedef _T2 second_type;
template <class _U1, class _U2, class = typename is_convertible< first_type>::type>
pair(_U1&& , _U2&& ); // expected-note {{candidate}}
};
template <class _ForwardIterator>
pair<_ForwardIterator, _ForwardIterator> __equal_range(_ForwardIterator) {
return pair<_ForwardIterator, _ForwardIterator>(0, 0); // expected-error {{no matching constructor}}
}
template <class _ForwardIterator>
pair<_ForwardIterator, _ForwardIterator> equal_range( _ForwardIterator a) {
return __equal_range(a); // expected-note {{instantiation}}
}
class A {
pair<int, int> range() {
return equal_range(0); // expected-note {{instantiation}}
}
};
#else
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/blocks.c
|
// Test this without pch.
// RUN: %clang_cc1 -fblocks -include %S/blocks.h -fsyntax-only -emit-llvm -o - %s
// Test with pch.
// RUN: %clang_cc1 -emit-pch -fblocks -o %t %S/blocks.h
// RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -emit-llvm -o - %s
int do_add(int x, int y) { return add(x, y); }
int do_scaled_add(int a, int b, int s) {
return scaled_add(a, b, s);
}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/exprs.c
|
// Test this without pch.
// RUN: %clang_cc1 -fblocks -include %S/exprs.h -fsyntax-only -verify %s
// Test with pch.
// RUN: %clang_cc1 -emit-pch -fblocks -o %t %S/exprs.h
// RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify %s -DWITH_PCH
#ifdef WITH_PCH
// expected-no-diagnostics
#endif
__SIZE_TYPE__ size_type_value;
int integer;
long long_integer;
double floating;
_Complex double floating_complex;
// DeclRefExpr
int_decl_ref *int_ptr1 = &integer;
enum_decl_ref *enum_ptr1 = &integer;
// IntegerLiteral
integer_literal *int_ptr2 = &integer;
long_literal *long_ptr1 = &long_integer;
// FloatingLiteral + ParenExpr
floating_literal *double_ptr = &floating;
// ImaginaryLiteral
imaginary_literal *cdouble_ptr = &floating_complex;
// StringLiteral
const char* printHello() {
return hello;
}
// CharacterLiteral
char_literal *int_ptr3 = &integer;
// UnaryOperator
negate_enum *int_ptr4 = &integer;
// OffsetOfExpr
offsetof_type *offsetof_ptr = &size_type_value;
// UnaryExprOrTypeTraitExpr
typeof(sizeof(float)) size_t_value;
typeof_sizeof *size_t_ptr = &size_t_value;
typeof_sizeof2 *size_t_ptr2 = &size_t_value;
// ArraySubscriptExpr
array_subscript *double_ptr1_5 = &floating;
// CallExpr
call_returning_double *double_ptr2 = &floating;
// MemberExpr
member_ref_double *double_ptr3 = &floating;
// BinaryOperator
add_result *int_ptr5 = &integer;
// CompoundAssignOperator
addeq_result *int_ptr6 = &integer;
add_result_with_typeinfo *int_typeinfo_ptr6;
// ConditionalOperator
conditional_operator *double_ptr4 = &floating;
// CStyleCastExpr
void_ptr vp1 = &integer;
// CompoundLiteral
struct S s;
compound_literal *sptr = &s;
// ExtVectorElementExpr
ext_vector_element *double_ptr5 = &floating;
// InitListExpr
double get_from_double_array(unsigned Idx) { return double_array[Idx]; }
/// DesignatedInitExpr
float get_from_designated(unsigned Idx) {
return designated_inits[2].y;
}
// TypesCompatibleExpr
types_compatible *int_ptr7 = &integer;
// ChooseExpr
choose_expr *int_ptr8 = &integer;
// GNUNullExpr FIXME: needs C++
//null_type null = __null;
// ShuffleVectorExpr
shuffle_expr *vec_ptr = &vec2;
// GenericSelectionExpr
generic_selection_expr *double_ptr6 = &floating;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/remap-file-from-pch.cpp
|
// %clang_cc1 -remap-file "%s;%S/Inputs/remapped-file" -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-EXIST %s
// RUN: %clang_cc1 -x c++-header %s.h -emit-pch -o %t.pch
// RUN: not %clang_cc1 %s -include-pch %t.pch -remap-file "%s.h;%s.remap.h" -fsyntax-only 2>&1 | FileCheck %s
const char *str = STR;
int ge = zool;
// CHECK: file '{{.*[/\\]}}remap-file-from-pch.cpp.h' from the precompiled header has been overridden
// CHECK: use of undeclared identifier 'zool'
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-member-init.cpp
|
// Test this without pch.
// RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -DSOURCE -fsyntax-only -emit-llvm -o - %s
// Test with pch.
// RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -emit-pch -o %t %s
// RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -include-pch %t -fsyntax-only -emit-llvm -o - %s
#ifdef HEADER
int n;
struct S {
int *p = &m;
int &m = n;
S *that = this;
};
template<typename T> struct X { T t {0}; };
struct v_t { };
struct m_t
{
struct { v_t v; };
m_t() { }
};
#endif
#ifdef SOURCE
S s;
struct E { explicit E(int); };
X<E> x;
m_t *test() {
return new m_t;
}
#elif HEADER
#undef HEADER
#define SOURCE
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/pr4489.c
|
// RUN: %clang -x c-header -o %t.pch %s
// RUN: echo > %t.empty.c
// RUN: %clang -include %t -x c %t.empty.c -emit-llvm -S -o -
// PR 4489: Crash with PCH
// PR 4492: Crash with PCH (round two)
// PR 4509: Crash with PCH (round three)
typedef struct _IO_FILE FILE;
extern int fprintf (struct _IO_FILE *__restrict __stream,
__const char *__restrict __format, ...);
int x(void)
{
switch (1) {
case 2: ;
int y = 0;
}
}
void y(void) {
extern char z;
fprintf (0, "a");
}
struct y0 { int i; } y0[1] = {};
void x0(void)
{
extern char z0;
fprintf (0, "a");
}
void x1(void)
{
fprintf (0, "asdf");
}
void y1(void)
{
extern char e;
fprintf (0, "asdf");
}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-empty-initial-namespace.cpp
|
// no PCH
// RUN: %clang_cc1 -include %s -include %s -fsyntax-only %s
// full PCH
// RUN: %clang_cc1 -chain-include %s -chain-include %s -fsyntax-only %s
#if !defined(PASS1)
#define PASS1
namespace foo {} // no external storage
#elif !defined(PASS2)
#define PASS2
namespace foo {
void bar();
}
#else
// PASS3
void test() {
foo::bar(); // no-error
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx11-inheriting-ctors.cpp
|
// RUN: %clang_cc1 -std=c++11 -emit-pch -o %t %s
// RUN: %clang_cc1 -std=c++11 -include-pch %t -verify %s
// expected-no-diagnostics
#ifndef HEADER_INCLUDED
#define HEADER_INCLUDED
struct Base {
Base(int) {}
template <typename T>
Base(T) {}
};
struct Test : Base {
using Base::Base;
};
template <typename T>
struct Test2 : Base {
using Base::Base;
};
template <typename B>
struct Test3 : B {
using B::B;
};
#else
Test test1a(42);
Test test1b(nullptr);
Test2<int> test2a(42);
Test2<int> test2b(nullptr);
Test3<Base> test3a(42);
Test3<Base> test3b(nullptr);
#endif // HEADER_INCLUDED
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-openmp-threadprivate.cpp
|
// no PCH
// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -emit-llvm -include %s -include %s %s -o - | FileCheck %s
// with PCH
// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s
// no PCH
// RUN: %clang_cc1 -fopenmp -emit-llvm -include %s -include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-1
// RUN: %clang_cc1 -fopenmp -emit-llvm -include %s -include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-2
// with PCH
// RUN: %clang_cc1 -fopenmp -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-1
// RUN: %clang_cc1 -fopenmp -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-2
// REQUIRES: tls
#if !defined(PASS1)
#define PASS1
extern "C" int* malloc (int size);
int *a = malloc(20);
#elif !defined(PASS2)
#define PASS2
#pragma omp threadprivate(a)
#else
// CHECK: call {{.*}} @__kmpc_threadprivate_register(
// CHECK-TLS-1: @{{a|\"\\01\?a@@3PE?AHE?A\"}} = {{.*}}thread_local {{.*}}global {{.*}}i32*
// CHECK-LABEL: foo
// CHECK-TLS-LABEL: foo
int foo() {
return *a;
// CHECK: call {{.*}} @__kmpc_global_thread_num(
// CHECK: call {{.*}} @__kmpc_threadprivate_cached(
// CHECK-TLS-1: call {{.*}} @{{_ZTW1a|\"\\01\?\?__Ea@@YAXXZ\"}}()
}
// CHECK-TLS-2: define {{.*}} @{{_ZTW1a|\"\\01\?\?__Ea@@YAXXZ\"}}()
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/variables.c
|
// 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
#ifndef HEADER
#define HEADER
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
#else
int *ip2 = &x;
float *fp = &ip; // expected-warning{{incompatible pointer types}}
double z; // expected-error{{redefinition}} expected-note@14{{previous}}
int z2 = 18; // expected-error{{redefinition}} expected-note@16{{previous}}
double VeryHappy; // expected-error{{redefinition}} expected-note@19{{previous definition is here}}
int Q = A_MACRO_IN_THE_PCH;
int R = FUNCLIKE_MACRO(A_MACRO_, IN_THE_PCH);
int UNIQUE(a); // a2
int *Arr[] = { &a0, &a1, &a2 };
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx_exprs.h
|
// Header for PCH test cxx_exprs.cpp
// CXXStaticCastExpr
typedef __typeof__(static_cast<void *>(0)) static_cast_result;
// CXXDynamicCastExpr
struct Base { Base(int); virtual void f(int x = 492); ~Base(); };
struct Derived : Base { Derived(); void g(); };
Base *base_ptr;
typedef __typeof__(dynamic_cast<Derived *>(base_ptr)) dynamic_cast_result;
// CXXReinterpretCastExpr
typedef __typeof__(reinterpret_cast<void *>(0)) reinterpret_cast_result;
// CXXConstCastExpr
const char *const_char_ptr_value;
typedef __typeof__(const_cast<char *>(const_char_ptr_value)) const_cast_result;
// CXXFunctionalCastExpr
int int_value;
typedef __typeof__(double(int_value)) functional_cast_result;
// CXXBoolLiteralExpr
typedef __typeof__(true) bool_literal_result;
const bool true_value = true;
const bool false_value = false;
// CXXNullPtrLiteralExpr
typedef __typeof__(nullptr) cxx_null_ptr_result;
void foo(Derived *P) {
// CXXMemberCallExpr
P->f(12);
}
// FIXME: This is a hack until <typeinfo> works completely.
namespace std {
class type_info {};
}
// CXXTypeidExpr - Both expr and type forms.
typedef __typeof__(typeid(int))* typeid_result1;
typedef __typeof__(typeid(2))* typeid_result2;
Derived foo();
Derived::Derived() : Base(4) {
}
void Derived::g() {
// CXXThisExpr
f(2); // Implicit
this->f(1); // Explicit
// CXXThrowExpr
throw;
throw 42;
// CXXDefaultArgExpr
f();
const Derived &X = foo();
// FIXME: How do I make a CXXBindReferenceExpr, CXXConstructExpr?
int A = int(0.5); // CXXFunctionalCastExpr
A = int(); // CXXZeroInitValueExpr
Base *b = new Base(4); // CXXNewExpr
delete b; // CXXDeleteExpr
}
// FIXME: The comment on CXXTemporaryObjectExpr is broken, this doesn't make
// one.
struct CtorStruct { CtorStruct(int, float); };
CtorStruct create_CtorStruct() {
return CtorStruct(1, 3.14f); // CXXTemporaryObjectExpr
};
// CharacterLiteral variants
const char char_value = 'a';
const wchar_t wchar_t_value = L'ı';
const char16_t char16_t_value = u'ç';
const char32_t char32_t_value = U'∂';
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/preprocess.c
|
// Check that -E mode is invariant when using an implicit PCH.
// RUN: %clang_cc1 -include %S/preprocess.h -E -o %t.orig %s
// RUN: %clang_cc1 -emit-pch -o %t %S/preprocess.h
// RUN: %clang_cc1 -include-pch %t -E -o %t.from_pch %s
// RUN: diff %t.orig %t.from_pch
a_typedef a_value;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-constexpr.cpp
|
// RUN: %clang_cc1 -pedantic-errors -std=c++98 -emit-pch %s -o %t
// RUN: %clang_cc1 -pedantic-errors -std=c++98 -include-pch %t -verify %s
// 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
// RUN: %clang_cc1 -pedantic-errors -std=c++98 -emit-pch %s -o %t -fmodules
// RUN: %clang_cc1 -pedantic-errors -std=c++98 -include-pch %t -verify %s -fmodules
#ifndef HEADER_INCLUDED
#define HEADER_INCLUDED
extern const int a;
const int b = a;
#else
const int a = 5;
typedef int T[b]; // expected-error {{variable length array}} expected-error {{must be an integer constant expression}}
typedef int T[5];
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-friends.h
|
// Header for PCH test cxx-friends.cpp
class A {
int x;
friend class F;
};
namespace PR12585 {
struct future_base {
template<typename> class setter;
};
template<typename> class promise {
// We used to inject this into future_base with no access specifier,
// then crash during AST writing.
template<typename> friend class future_base::setter;
int k;
};
}
namespace Lazy {
struct S {
friend void doNotDeserialize();
};
}
// Reduced testcase from libc++'s <valarray>. Used to crash with modules
// enabled.
namespace std {
template <class T> struct valarray;
template <class T> struct valarray {
valarray();
template <class U> friend struct valarray;
template <class U> friend U *begin(valarray<U> &v);
};
struct gslice {
valarray<int> size;
gslice() {}
};
}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-alias-decl.cpp
|
// Test this without pch.
// RUN: %clang_cc1 -x c++ -std=c++11 -include %S/cxx-alias-decl.h -fsyntax-only -emit-llvm -o - %s
// Test with pch.
// RUN: %clang_cc1 -x c++ -std=c++11 -emit-pch -o %t %S/cxx-alias-decl.h
// RUN: %clang_cc1 -x c++ -std=c++11 -include-pch %t -fsyntax-only -emit-llvm -o - %s
template struct T<S>;
C<A>::A<char> a;
using T1 = decltype(a);
using T1 = D<int, char>;
using T2 = B<A>;
using T2 = S;
using A = int;
template<typename U> using B = S;
template<typename U> using C = T<U>;
template<typename U, typename V> using D = typename T<U>::template A<V>;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/remap-file-from-pch.cpp.h
|
#define STR "nexus"
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/working-directory.cpp
|
// Test this without pch.
// RUN: %clang_cc1 -working-directory %S -I. -include working-directory.h %s -Wunused
// Test with pch.
// RUN: %clang_cc1 -working-directory %S -x c++-header -emit-pch -o %t.pch -I. working-directory.h
// RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only %s -Wunused
void f() {
// Instantiating A<char> will trigger a warning, which will end up trying to get the path to
// the header that contains A.
A<char> b;
}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/types.c
|
// Test this without pch.
// RUN: %clang_cc1 -fblocks -include %S/types.h -fsyntax-only -verify %s
// Test with pch.
// RUN: %clang_cc1 -emit-pch -fblocks -o %t %S/types.h
// RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify %s -ast-print
typedef int INT;
INT int_value;
__attribute__((address_space(1))) int int_as_one;
// TYPE_EXT_QUAL
ASInt *as_int_ptr1 = &int_value; // expected-error{{changes address space of pointer}}
ASInt *as_int_ptr2 = &int_as_one;
// TYPE_COMPLEX
_Complex float Cfloat_val;
Cfloat *Cfloat_ptr = &Cfloat_val;
// TYPE_ATOMIC
_Atomic(int) AtomicInt_val;
AtomicInt *AtomicInt_ptr = &AtomicInt_val;
// TYPE_POINTER
int_ptr int_value_ptr = &int_value;
// TYPE_BLOCK_POINTER
void test_block_ptr(Block *bl) {
*bl = ^(int x, float f) { return x; };
}
// TYPE_CONSTANT_ARRAY
five_ints fvi = { 1, 2, 3, 4, 5 };
// TYPE_INCOMPLETE_ARRAY
float_array fa1 = { 1, 2, 3 };
float_array fa2 = { 1, 2, 3, 4, 5, 6, 7, 8 };
// TYPE_VARIABLE_ARRAY in stmts.[ch]
// TYPE_VECTOR
float4 f4 = { 1.0, 2.0, 3.0, 4.0 };
// TYPE_EXT_VECTOR
ext_float4 ef4 = { 1.0, 2.0, 3.0, 4.0 };
// TYPE_FUNCTION_NO_PROTO
noproto np1;
int np1(x, y)
int x;
float y;
{
return x;
}
// TYPE_FUNCTION_PROTO
proto p1;
float p1(float x, float y, ...) {
return x + y;
}
proto *p2 = p1;
// TYPE_TYPEDEF
int_ptr_ptr ipp = &int_value_ptr;
// TYPE_TYPEOF_EXPR
typeof_17 *t17 = &int_value;
struct S { int x, y; };
typeof_17 t17_2 = (struct S){1, 2}; // expected-error{{initializing 'typeof_17' (aka 'int') with an expression of incompatible type 'struct S'}}
// TYPE_TYPEOF
int_ptr_ptr2 ipp2 = &int_value_ptr;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/pch__VA_ARGS__.h
|
// Header for PCH test fuzzy-pch.c
void f(int X);
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-functions.cpp
|
// Test this without pch.
// RUN: %clang_cc1 -include %S/cxx-functions.h -fsyntax-only -verify %s
// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-functions.h
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
// expected-no-diagnostics
void test_foo() {
foo();
}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-key-functions.cpp
|
// RUN: %clang_cc1 -x c++ -include %s -emit-llvm-only %s
// RUN: %clang_cc1 -x c++ -emit-pch %s -o %t
// RUN: %clang_cc1 -include-pch %t -emit-llvm-only %s
#ifndef HEADER
#define HEADER
struct S00 { virtual void f(); };
struct S01 { virtual void f(); };
struct S02 { virtual void f(); };
struct S03 { virtual void f(); };
struct S04 { virtual void f(); };
struct S05 { virtual void f(); };
struct S06 { virtual void f(); };
struct S07 { virtual void f(); };
struct S08 { virtual void f(); };
struct S09 { virtual void f(); };
struct S10 { virtual void f(); };
struct S11 { virtual void f(); };
struct S12 { virtual void f(); };
struct S13 { virtual void f(); };
struct S14 { virtual void f(); };
struct S15 { virtual void f(); };
struct S16 { virtual void f(); };
struct S17 { virtual void f(); };
struct S18 { virtual void f(); };
struct S19 { virtual void f(); };
struct S20 { virtual void f(); };
struct S21 { virtual void f(); };
struct S22 { virtual void f(); };
struct S23 { virtual void f(); };
struct S24 { virtual void f(); };
struct S25 { virtual void f(); };
struct S26 { virtual void f(); };
struct S27 { virtual void f(); };
struct S28 { virtual void f(); };
struct S29 { virtual void f(); };
struct S30 { virtual void f(); };
struct S31 { virtual void f(); };
struct S32 { virtual void f(); };
struct S33 { virtual void f(); };
struct S34 { virtual void f(); };
struct S35 { virtual void f(); };
struct S36 { virtual void f(); };
struct S37 { virtual void f(); };
struct S38 { virtual void f(); };
struct S39 { virtual void f(); };
struct S40 { virtual void f(); };
struct S41 { virtual void f(); };
struct S42 { virtual void f(); };
struct S43 { virtual void f(); };
struct S44 { virtual void f(); };
struct S45 { virtual void f(); };
struct S46 { virtual void f(); };
struct S47 { virtual void f(); };
struct S48 { virtual void f(); };
struct S49 { virtual void f(); };
struct S50 { virtual void f(); };
struct S51 { virtual void f(); };
struct S52 { virtual void f(); };
struct S53 { virtual void f(); };
struct S54 { virtual void f(); };
struct S55 { virtual void f(); };
struct S56 { virtual void f(); };
struct S57 { virtual void f(); };
struct S58 { virtual void f(); };
struct S59 { virtual void f(); };
struct S60 { virtual void f(); };
struct S61 { virtual void f(); };
struct S62 { virtual void f(); };
struct S63 { virtual void f(); };
struct S64 { virtual void f(); };
struct S65 { virtual void f(); };
struct S66 { virtual void f(); };
struct S67 { virtual void f(); };
struct S68 { virtual void f(); };
struct S69 { virtual void f(); };
struct Test {
// Deserializing this key function should cause the key functions
// table to get resized.
virtual void f(S00, S01, S02, S03, S04, S05, S06, S07, S08, S09,
S10, S11, S12, S13, S14, S15, S16, S17, S18, S19,
S20, S21, S22, S23, S24, S25, S26, S27, S28, S29,
S30, S31, S32, S33, S34, S35, S36, S37, S38, S39,
S40, S41, S42, S43, S44, S45, S46, S47, S48, S49,
S50, S51, S52, S53, S54, S55, S56, S57, S58, S59,
S60, S61, S62, S63, S64, S65, S66, S67, S68, S69);
virtual void g();
};
#else
void Test::g() {}
void h(Test &t) { t.g(); }
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/format-strings.c
|
// RUN: %clang_cc1 -D FOOBAR="\"\"" %s -emit-pch -o %t.pch
// RUN: %clang_cc1 -D FOOBAR="\"\"" %s -include-pch %t.pch
// rdar://11418366
#ifndef HEADER
#define HEADER
extern int printf(const char *restrict, ...);
#define LOG printf(FOOBAR "%f", __LINE__)
#else
void foo() {
LOG;
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx1y-default-initializer.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
struct A {
int x;
int y = 3;
int z = x + y;
};
template<typename T> constexpr A make() { return A {}; }
template<typename T> constexpr A make(T t) { return A { t }; }
struct B {
int z1, z2 = z1;
constexpr B(int k) : z1(k) {}
};
#else
static_assert(A{}.z == 3, "");
static_assert(A{1}.z == 4, "");
static_assert(A{.y = 5}.z == 5, ""); // expected-warning {{C99}}
static_assert(A{3, .y = 1}.z == 4, ""); // expected-warning {{C99}}
static_assert(make<int>().z == 3, "");
static_assert(make<int>(12).z == 15, "");
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/objc_methods.h
|
/* For use with the methods.m test */
@interface TestPCH
+ alloc;
- (instancetype)instMethod;
@end
@class TestForwardClassDecl;
// FIXME: @compatibility_alias AliasForTestPCH TestPCH;
// http://llvm.org/PR12689
@interface PR12689
@end
@implementation PR12689
-(void)mugi:(int)x {
switch(x) {
case 23: {}
}
}
-(void)bonk:(int)x {
switch(x) {
case 42: {}
}
}
@end
@interface PR12689_2
@end
@implementation PR12689_2
-(void)mugi:(int)x {
switch(x) {
case 23: [self bonk:x]; break;
case 82: break;
}
}
-(void)bonk:(int)x {
}
@end
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-static_assert.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
#ifndef HEADER
#define HEADER
template<int N> struct T {
static_assert(N == 2, "N is not 2!");
};
#else
// expected-error@12 {{static_assert failed "N is not 2!"}}
T<1> t1; // expected-note {{in instantiation of template class 'T<1>' requested here}}
T<2> t2;
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/struct.h
|
// Used with the struct.c test
struct Point {
float x, y, z;
};
struct Point2 {
float xValue, yValue, zValue;
};
struct Fun;
struct Fun *fun;
struct Fun {
int is_ptr : 1;
union {
void *ptr;
int *integer;
};
};
struct Fun2;
struct Fun2 *fun2;
struct S {
struct Nested { int x, y; } nest;
};
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/pr18806.cpp
|
// RUN: %clang_cc1 -std=c++11 -emit-pch -o %t %s
// RUN: %clang_cc1 -std=c++11 -include-pch %t -verify %s
// expected-no-diagnostics
// Before the patch, this test triggered an assert violation in
// ASTContext::getSubstTemplateTypeParmType.
#ifndef HEADER_INCLUDED
#define HEADER_INCLUDED
template <typename T>
using Id = T;
template <typename X>
struct Class1 {
template <typename Y, typename = decltype(Y())>
struct Nested1;
};
template <typename A>
struct Class2 {
template <typename B, typename = Id<decltype(B())>>
struct Nested2;
};
#else
Class2<char> test;
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/pth.c
|
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-pth -o %t %S/pth.h
// RUN: not %clang_cc1 -triple i386-unknown-unknown -include-pth %t -fsyntax-only %s 2>&1 | FileCheck %s
#error This is the only diagnostic
// CHECK: This is the only diagnostic
// CHECK: 1 error generated.
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/thread-safety-attrs.cpp
|
// Test this without pch.
// RUN: %clang_cc1 -include %s -fsyntax-only -verify -Wthread-safety -std=c++11 %s
// Test with pch.
// RUN: %clang_cc1 -emit-pch -o %t %s -std=c++11
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify -Wthread-safety -std=c++11 %s
#ifndef HEADER
#define HEADER
#define LOCKABLE __attribute__ ((lockable))
#define SCOPED_LOCKABLE __attribute__ ((scoped_lockable))
#define GUARDED_BY(x) __attribute__ ((guarded_by(x)))
#define GUARDED_VAR __attribute__ ((guarded_var))
#define PT_GUARDED_BY(x) __attribute__ ((pt_guarded_by(x)))
#define PT_GUARDED_VAR __attribute__ ((pt_guarded_var))
#define ACQUIRED_AFTER(...) __attribute__ ((acquired_after(__VA_ARGS__)))
#define ACQUIRED_BEFORE(...) __attribute__ ((acquired_before(__VA_ARGS__)))
#define EXCLUSIVE_LOCK_FUNCTION(...) __attribute__ ((exclusive_lock_function(__VA_ARGS__)))
#define SHARED_LOCK_FUNCTION(...) __attribute__ ((shared_lock_function(__VA_ARGS__)))
#define EXCLUSIVE_TRYLOCK_FUNCTION(...) __attribute__ ((exclusive_trylock_function(__VA_ARGS__)))
#define SHARED_TRYLOCK_FUNCTION(...) __attribute__ ((shared_trylock_function(__VA_ARGS__)))
#define UNLOCK_FUNCTION(...) __attribute__ ((unlock_function(__VA_ARGS__)))
#define LOCK_RETURNED(x) __attribute__ ((lock_returned(x)))
#define LOCKS_EXCLUDED(...) __attribute__ ((locks_excluded(__VA_ARGS__)))
#define EXCLUSIVE_LOCKS_REQUIRED(...) \
__attribute__ ((exclusive_locks_required(__VA_ARGS__)))
#define SHARED_LOCKS_REQUIRED(...) \
__attribute__ ((shared_locks_required(__VA_ARGS__)))
#define NO_THREAD_SAFETY_ANALYSIS __attribute__ ((no_thread_safety_analysis))
class __attribute__((lockable)) Mutex {
public:
void Lock() __attribute__((exclusive_lock_function));
void ReaderLock() __attribute__((shared_lock_function));
void Unlock() __attribute__((unlock_function));
bool TryLock() __attribute__((exclusive_trylock_function(true)));
bool ReaderTryLock() __attribute__((shared_trylock_function(true)));
void LockWhen(const int &cond) __attribute__((exclusive_lock_function));
};
class __attribute__((scoped_lockable)) MutexLock {
public:
MutexLock(Mutex *mu) __attribute__((exclusive_lock_function(mu)));
~MutexLock() __attribute__((unlock_function));
};
class __attribute__((scoped_lockable)) ReaderMutexLock {
public:
ReaderMutexLock(Mutex *mu) __attribute__((exclusive_lock_function(mu)));
~ReaderMutexLock() __attribute__((unlock_function));
};
class SCOPED_LOCKABLE ReleasableMutexLock {
public:
ReleasableMutexLock(Mutex *mu) EXCLUSIVE_LOCK_FUNCTION(mu);
~ReleasableMutexLock() UNLOCK_FUNCTION();
void Release() UNLOCK_FUNCTION();
};
// The universal lock, written "*", allows checking to be selectively turned
// off for a particular piece of code.
void beginNoWarnOnReads() SHARED_LOCK_FUNCTION("*");
void endNoWarnOnReads() UNLOCK_FUNCTION("*");
void beginNoWarnOnWrites() EXCLUSIVE_LOCK_FUNCTION("*");
void endNoWarnOnWrites() UNLOCK_FUNCTION("*");
// For testing handling of smart pointers.
template<class T>
class SmartPtr {
public:
SmartPtr(T* p) : ptr_(p) { }
SmartPtr(const SmartPtr<T>& p) : ptr_(p.ptr_) { }
~SmartPtr();
T* get() const { return ptr_; }
T* operator->() const { return ptr_; }
T& operator*() const { return *ptr_; }
private:
T* ptr_;
};
// For testing destructor calls and cleanup.
class MyString {
public:
MyString(const char* s);
~MyString();
};
Mutex sls_mu;
Mutex sls_mu2 __attribute__((acquired_after(sls_mu)));
int sls_guard_var __attribute__((guarded_var)) = 0;
int sls_guardby_var __attribute__((guarded_by(sls_mu))) = 0;
bool getBool();
class MutexWrapper {
public:
Mutex mu;
int x __attribute__((guarded_by(mu)));
void MyLock() __attribute__((exclusive_lock_function(mu)));
};
#else
MutexWrapper sls_mw;
void sls_fun_0() {
sls_mw.mu.Lock();
sls_mw.x = 5;
sls_mw.mu.Unlock();
}
void sls_fun_2() {
sls_mu.Lock();
int x = sls_guard_var;
sls_mu.Unlock();
}
void sls_fun_3() {
sls_mu.Lock();
sls_guard_var = 2;
sls_mu.Unlock();
}
void sls_fun_4() {
sls_mu2.Lock();
sls_guard_var = 2;
sls_mu2.Unlock();
}
void sls_fun_5() {
sls_mu.Lock();
int x = sls_guardby_var;
sls_mu.Unlock();
}
void sls_fun_6() {
sls_mu.Lock();
sls_guardby_var = 2;
sls_mu.Unlock();
}
void sls_fun_7() {
sls_mu.Lock();
sls_mu2.Lock();
sls_mu2.Unlock();
sls_mu.Unlock();
}
void sls_fun_8() {
sls_mu.Lock();
if (getBool())
sls_mu.Unlock();
else
sls_mu.Unlock();
}
void sls_fun_9() {
if (getBool())
sls_mu.Lock();
else
sls_mu.Lock();
sls_mu.Unlock();
}
void sls_fun_good_6() {
if (getBool()) {
sls_mu.Lock();
} else {
if (getBool()) {
getBool(); // EMPTY
} else {
getBool(); // EMPTY
}
sls_mu.Lock();
}
sls_mu.Unlock();
}
void sls_fun_good_7() {
sls_mu.Lock();
while (getBool()) {
sls_mu.Unlock();
if (getBool()) {
if (getBool()) {
sls_mu.Lock();
continue;
}
}
sls_mu.Lock();
}
sls_mu.Unlock();
}
void sls_fun_good_8() {
sls_mw.MyLock();
sls_mw.mu.Unlock();
}
void sls_fun_bad_1() {
sls_mu.Unlock(); // \
// expected-warning{{releasing mutex 'sls_mu' that was not held}}
}
void sls_fun_bad_2() {
sls_mu.Lock();
sls_mu.Lock(); // \
// expected-warning{{acquiring mutex 'sls_mu' that is already held}}
sls_mu.Unlock();
}
void sls_fun_bad_3() {
sls_mu.Lock(); // expected-note {{mutex acquired here}}
} // expected-warning{{mutex 'sls_mu' is still held at the end of function}}
void sls_fun_bad_4() {
if (getBool())
sls_mu.Lock(); // expected-note{{mutex acquired here}}
else
sls_mu2.Lock(); // expected-note{{mutex acquired here}}
} // expected-warning{{mutex 'sls_mu' is not held on every path through here}} \
// expected-warning{{mutex 'sls_mu2' is not held on every path through here}}
void sls_fun_bad_5() {
sls_mu.Lock(); // expected-note {{mutex acquired here}}
if (getBool())
sls_mu.Unlock();
} // expected-warning{{mutex 'sls_mu' is not held on every path through here}}
void sls_fun_bad_6() {
if (getBool()) {
sls_mu.Lock(); // expected-note {{mutex acquired here}}
} else {
if (getBool()) {
getBool(); // EMPTY
} else {
getBool(); // EMPTY
}
}
sls_mu.Unlock(); // \
expected-warning{{mutex 'sls_mu' is not held on every path through here}}\
expected-warning{{releasing mutex 'sls_mu' that was not held}}
}
void sls_fun_bad_7() {
sls_mu.Lock();
while (getBool()) {
sls_mu.Unlock();
if (getBool()) {
if (getBool()) {
continue; // \
expected-warning{{expecting mutex 'sls_mu' to be held at start of each loop}}
}
}
sls_mu.Lock(); // expected-note {{mutex acquired here}}
}
sls_mu.Unlock();
}
void sls_fun_bad_8() {
sls_mu.Lock(); // expected-note{{mutex acquired here}}
do {
sls_mu.Unlock(); // expected-warning{{expecting mutex 'sls_mu' to be held at start of each loop}}
} while (getBool());
}
void sls_fun_bad_9() {
do {
sls_mu.Lock(); // \
// expected-warning{{expecting mutex 'sls_mu' to be held at start of each loop}} \
// expected-note{{mutex acquired here}}
} while (getBool());
sls_mu.Unlock();
}
void sls_fun_bad_10() {
sls_mu.Lock(); // expected-note 2{{mutex acquired here}}
while(getBool()) { // expected-warning{{expecting mutex 'sls_mu' to be held at start of each loop}}
sls_mu.Unlock();
}
} // expected-warning{{mutex 'sls_mu' is still held at the end of function}}
void sls_fun_bad_11() {
while (getBool()) { // \
expected-warning{{expecting mutex 'sls_mu' to be held at start of each loop}}
sls_mu.Lock(); // expected-note {{mutex acquired here}}
}
sls_mu.Unlock(); // \
// expected-warning{{releasing mutex 'sls_mu' that was not held}}
}
void sls_fun_bad_12() {
sls_mu.Lock(); // expected-note {{mutex acquired here}}
while (getBool()) {
sls_mu.Unlock();
if (getBool()) {
if (getBool()) {
break; // expected-warning{{mutex 'sls_mu' is not held on every path through here}}
}
}
sls_mu.Lock();
}
sls_mu.Unlock();
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/modified-header-crash.c
|
// Don't crash.
// RUN: cp %S/modified-header-crash.h %t.h
// RUN: %clang_cc1 -DCAKE -x c-header %t.h -emit-pch -o %t
// RUN: echo 'int foobar;' >> %t.h
// RUN: not %clang_cc1 %s -include-pch %t -fsyntax-only
// FIXME: It is intended to suppress this on win32.
// REQUIRES: ansi-escape-sequences
void f(void) {
foo = 3;
}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/rdar10830559.cpp
|
// Test this without pch.
// RUN: %clang_cc1 -fsyntax-only -emit-llvm-only %s
// Test with pch.
// RUN: touch %t.empty.cpp
// RUN: %clang_cc1 -emit-pch -o %t %s
// RUN: %clang_cc1 -include-pch %t -emit-llvm-only %t.empty.cpp
// rdar://10830559
//#pragma ms_struct on
template< typename T >
class Templated
{
public:
struct s;
};
class Foo
{
private:
class Bar
{
private:
class BarTypes { public: virtual void Func(); };
class BarImpl {};
friend class Foo;
};
friend class Templated< Bar::BarImpl >::s;
};
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/remap-file-from-pch.cpp.remap.h
|
#define STR "nexus"
int zool;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/pch__VA_ARGS__.c
|
// Test with pch.
// RUN: %clang_cc1 -emit-pch -o %t %S/pch__VA_ARGS__.h
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -Weverything %s 2>&1 | FileCheck %s
#define mylog(...) printf(__VA_ARGS__)
// CHECK-NOT: warning: __VA_ARGS__ can only appear in the expansion of a C99 variadic macro
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/pragma-diag.c
|
// Test this without pch.
// RUN: %clang_cc1 %s -include %s -verify -fsyntax-only
// Test with pch.
// RUN: %clang_cc1 %s -emit-pch -o %t
// RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only
// expected-no-diagnostics
#ifndef HEADER
#define HEADER
#pragma clang diagnostic ignored "-Wtautological-compare"
#else
void f() {
int a = 0;
int b = a==a;
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/asm.c
|
// REQUIRES: x86-registered-target
// Test this without pch.
// RUN: %clang_cc1 -triple i386-unknown-unknown -include %S/asm.h -fsyntax-only -verify %s
// Test with pch.
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-pch -o %t %S/asm.h
// RUN: %clang_cc1 -triple i386-unknown-unknown -include-pch %t -fsyntax-only -verify %s
// expected-no-diagnostics
void call_f(void) { f(); }
void call_clobbers(void) { clobbers(); }
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-ext_vector.c
|
// Test this without pch.
// RUN: %clang_cc1 -include %S/Inputs/chain-ext_vector1.h -include %S/Inputs/chain-ext_vector2.h -fsyntax-only -verify %s
// Test with pch.
// RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-ext_vector1.h
// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-ext_vector2.h -include-pch %t1
// RUN: %clang_cc1 -include-pch %t2 -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/builtins.h
|
// Header for PCH test builtins.c
int printf(char const *, ...);
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-templates.cpp
|
// Test this without pch.
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -include %S/cxx-templates.h -verify %s -ast-dump -o -
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -include %S/cxx-templates.h %s -emit-llvm -o - -DNO_ERRORS | FileCheck %s
// Test with pch.
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -x c++-header -emit-pch -o %t %S/cxx-templates.h
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -include-pch %t -verify %s -ast-dump -o -
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -include-pch %t %s -emit-llvm -o - -error-on-deserialized-decl doNotDeserialize -DNO_ERRORS | FileCheck %s
// Test with modules.
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -fmodules -x c++-header -emit-pch -o %t %S/cxx-templates.h
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -fmodules -include-pch %t -verify %s -ast-dump -o -
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fexceptions -fmodules -include-pch %t %s -emit-llvm -o - -error-on-deserialized-decl doNotDeserialize -DNO_ERRORS -fmodules-ignore-macro=NO_ERRORS | FileCheck %s
// Test with pch and delayed template parsing.
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fdelayed-template-parsing -fexceptions -x c++-header -emit-pch -o %t %S/cxx-templates.h
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fdelayed-template-parsing -fexceptions -include-pch %t -verify %s -ast-dump -o -
// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -fcxx-exceptions -fdelayed-template-parsing -fexceptions -include-pch %t %s -emit-llvm -o - -DNO_ERRORS | FileCheck %s
// CHECK: define weak_odr {{.*}}void @_ZN2S4IiE1mEv
// CHECK: define linkonce_odr {{.*}}void @_ZN2S3IiE1mEv
struct A {
typedef int type;
static void my_f();
template <typename T>
static T my_templf(T x) { return x; }
};
void test(const int (&a6)[17]) {
int x = templ_f<int, 5>(3);
S<char, float>::templ();
S<int, char>::partial();
S<int, float>::explicit_special();
Dep<A>::Ty ty;
Dep<A> a;
a.f();
S3<int> s3;
s3.m();
TS5 ts(0);
S6<const int[17]>::t2 b6 = a6;
}
template struct S4<int>;
S7<int[5]> s7_5;
namespace ZeroLengthExplicitTemplateArgs {
template void f<X>(X*);
}
// This used to overwrite memory and crash.
namespace Test1 {
struct StringHasher {
template<typename T, char Converter(T)> static inline unsigned createHash(const T*, unsigned) {
return 0;
}
};
struct CaseFoldingHash {
static inline char foldCase(char) {
return 0;
}
static unsigned hash(const char* data, unsigned length) {
return StringHasher::createHash<char, foldCase>(data, length);
}
};
}
template< typename D >
Foo< D >& Foo< D >::operator=( const Foo& other )
{
return *this;
}
namespace TestNestedExpansion {
struct Int {
Int(int);
friend Int operator+(Int, Int);
};
Int &g(Int, int, double);
Int &test = NestedExpansion<char, char, char>().f(0, 1, 2, Int(3), 4, 5.0);
}
namespace rdar13135282 {
void test() {
__mt_alloc<> mt = __mt_alloc<>();
}
}
void CallDependentSpecializedFunc(DependentSpecializedFuncClass<int> &x) {
DependentSpecializedFunc(x);
}
namespace cyclic_module_load {
extern std::valarray<int> x;
std::valarray<int> y(x);
}
#ifndef NO_ERRORS
// [email protected]:305 {{incomplete}}
template int local_extern::f<int[]>(); // expected-note {{in instantiation of}}
#endif
template int local_extern::g<int[]>();
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/external-defs.h
|
// Helper for external-defs.c test
// Tentative definitions
int x;
int x2;
// Should not show up
static int z;
int incomplete_array[];
int incomplete_array2[];
struct S s;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/line-directive.c
|
// Test this without pch.
// RUN: not %clang_cc1 -include %S/line-directive.h -fsyntax-only %s 2>&1|grep "25:5"
// Test with pch.
// RUN: %clang_cc1 -emit-pch -o %t %S/line-directive.h
// RUN: not %clang_cc1 -include-pch %t -fsyntax-only %s 2>&1|grep "25:5"
double x; // expected-error{{redefinition of 'x' with a different type}}
// expected-note{{previous definition is here}}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/objc_property.h
|
/* For use with the objc_property.m PCH test */
@interface TestProperties
{
int value;
float percentage;
}
+ alloc;
@property int value;
@property float percentage;
@end
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/fuzzy-pch.h
|
// Header for PCH test fuzzy-pch.c
void f(int X);
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/exprs.h
|
// Header for PCH test exprs.c
// DeclRefExpr
int i = 17;
enum Enum { Enumerator = 18 };
typedef typeof(i) int_decl_ref;
typedef typeof(Enumerator) enum_decl_ref;
// IntegerLiteral
typedef typeof(17) integer_literal;
typedef typeof(17l) long_literal;
// FloatingLiteral and ParenExpr
typedef typeof((42.5)) floating_literal;
// ImaginaryLiteral
typedef typeof(17.0i) imaginary_literal;
// StringLiteral
const char *hello = "Hello" "PCH" "World";
// CharacterLiteral
typedef typeof('a') char_literal;
// UnaryOperator
typedef typeof(-Enumerator) negate_enum;
// OffsetOfExpr
struct X {
int member;
};
struct Y {
struct X array[5];
};
struct Z {
struct Y y;
};
typedef typeof(__builtin_offsetof(struct Z, y.array[1 + 2].member))
offsetof_type;
// UnaryExprOrTypeTraitExpr
typedef typeof(sizeof(int)) typeof_sizeof;
typedef typeof(sizeof(Enumerator)) typeof_sizeof2;
// ArraySubscriptExpr
extern double values[];
typedef typeof(values[2]) array_subscript;
// CallExpr
double dplus(double x, double y);
double d0, d1;
typedef typeof((&dplus)(d0, d1)) call_returning_double;
// MemberExpr
struct S {
double x;
};
typedef typeof(((struct S*)0)->x) member_ref_double;
// BinaryOperator
typedef typeof(i + Enumerator) add_result;
// CompoundAssignOperator
typedef typeof(i += Enumerator) addeq_result;
// ConditionalOperator
typedef typeof(i? : d0) conditional_operator;
// CStyleCastExpr
typedef typeof((void *)0) void_ptr;
// CompoundLiteral
typedef typeof((struct S){.x = 3.5}) compound_literal;
typedef typeof(i + sizeof(int[i + Enumerator])) add_result_with_typeinfo;
// ExtVectorElementExpr
typedef __attribute__(( ext_vector_type(2) )) double double2;
extern double2 vec2, vec2b;
typedef typeof(vec2.x) ext_vector_element;
// InitListExpr
double double_array[3] = { 1.0, 2.0 };
// DesignatedInitExpr
struct {
int x;
float y;
} designated_inits[3] = { [0].y = 17,
[2].x = 12.3, // expected-warning {{implicit conversion from 'double' to 'int' changes value from 12.3 to 12}}
3.5 };
// TypesCompatibleExpr
typedef typeof(__builtin_types_compatible_p(float, double)) types_compatible;
// ChooseExpr
typedef typeof(__builtin_choose_expr(17 > 19, d0, 1)) choose_expr;
// GNUNullExpr FIXME: needs C++
// typedef typeof(__null) null_type;
// ShuffleVectorExpr
typedef typeof(__builtin_shufflevector(vec2, vec2b, 2, 1)) shuffle_expr;
// ConvertVectorExpr
typedef __attribute__(( ext_vector_type(2) )) float float2;
typedef typeof(__builtin_convertvector(vec2, float2)) convert_expr;
// GenericSelectionExpr
typedef typeof(_Generic(i, char*: 0, int: 0., default: hello))
generic_selection_expr;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/pragma-optimize.c
|
// Test this without pch.
// RUN: %clang_cc1 %s -include %s -verify -fsyntax-only
// Test with pch.
// RUN: %clang_cc1 %s -emit-pch -o %t
// RUN: %clang_cc1 %s -emit-llvm -include-pch %t -o - | FileCheck %s
// The first run line creates a pch, and since at that point HEADER is not
// defined, the only thing contained in the pch is the pragma. The second line
// then includes that pch, so HEADER is defined and the actual code is compiled.
// The check then makes sure that the pragma is in effect in the file that
// includes the pch.
// expected-no-diagnostics
#ifndef HEADER
#define HEADER
#pragma clang optimize off
#else
int a;
void f() {
a = 12345;
}
// Check that the function is decorated with optnone
// CHECK-DAG: @f() [[ATTRF:#[0-9]+]]
// CHECK-DAG: attributes [[ATTRF]] = { {{.*}}noinline{{.*}}optnone{{.*}} }
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-functions.h
|
void foo() throw( int, short, char, float, double );
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/modified-header-error.c
|
// RUN: mkdir -p %t.dir
// RUN: echo '#include "header2.h"' > %t.dir/header1.h
// RUN: echo > %t.dir/header2.h
// RUN: cp %s %t.dir/t.c
// RUN: %clang_cc1 -x c-header %t.dir/header1.h -emit-pch -o %t.pch
// RUN: echo >> %t.dir/header2.h
// RUN: not %clang_cc1 %t.dir/t.c -include-pch %t.pch -fsyntax-only 2>&1 | FileCheck %s
#include "header2.h"
// CHECK: fatal error: file {{.*}} has been modified since the precompiled header {{.*}} was built
// REQUIRES: shell
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/different-linker-version.c
|
// RUN: %clang_cc1 -target-linker-version 100 -emit-pch %s -o %t.h.pch
// RUN: %clang_cc1 -target-linker-version 200 %s -include-pch %t.h.pch -fsyntax-only -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/cxx-implicit-moves.cpp
|
// Test with PCH
// RUN: %clang_cc1 -std=c++11 -x c++-header -emit-pch -o %t %s
// RUN: %clang_cc1 -std=c++11 -include-pch %t -verify %s
// expected-no-diagnostics
// PR10847
#ifndef HEADER
#define HEADER
struct NSSize {
double width;
double height;
};
typedef struct NSSize NSSize;
static inline NSSize NSMakeSize(double w, double h) {
NSSize s = { w, h };
return s;
}
#else
float test(float v1, float v2) {
NSSize s = NSMakeSize(v1, v2);
return s.width;
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-templates.h
|
// Header for PCH test cxx-templates.cpp
template <typename T1, typename T2>
struct S;
template <typename T1, typename T2>
struct S {
S() { }
static void templ();
};
template <typename T>
struct S<int, T> {
static void partial();
};
template <>
struct S<int, float> {
static void explicit_special();
};
template <int x>
int tmpl_f2() { return x; }
template <typename T, int y>
T templ_f(T x) {
int z = templ_f<int, 5>(3);
z = tmpl_f2<y+2>();
T data[y];
return x+y;
}
void govl(int);
void govl(char);
template <typename T>
struct Unresolv {
void f() {
govl(T());
}
};
template <typename T>
struct Dep {
typedef typename T::type Ty;
void f() {
Ty x = Ty();
T::my_f();
int y = T::template my_templf<int>(0);
ovl(y);
}
void ovl(int);
void ovl(float);
};
template<typename T, typename A1>
inline T make_a(const A1& a1) {
T::depend_declref();
return T(a1);
}
template <class T> class UseBase {
void foo();
typedef int bar;
};
template <class T> class UseA : public UseBase<T> {
using UseBase<T>::foo;
using typename UseBase<T>::bar;
};
template <class T> class Sub : public UseBase<int> { };
template <class _Ret, class _Tp>
class mem_fun_t
{
public:
explicit
mem_fun_t(_Ret (_Tp::*__pf)())
{}
private:
_Ret (_Tp::*_M_f)();
};
template<unsigned N>
bool isInt(int x);
template<> bool isInt<8>(int x) {
try { ++x; } catch(...) { --x; }
return true;
}
template<typename _CharT>
int __copy_streambufs_eof(_CharT);
class basic_streambuf
{
void m() { }
friend int __copy_streambufs_eof<>(int);
};
// PR 7660
template<typename T> struct S_PR7660 { void g(void (*)(T)); };
template<> void S_PR7660<int>::g(void(*)(int)) {}
// PR 7670
template<typename> class C_PR7670;
template<> class C_PR7670<int>;
template<> class C_PR7670<int>;
template <bool B>
struct S2 {
static bool V;
};
extern template class S2<true>;
template <typename T>
struct S3 {
void m();
};
template <typename T>
inline void S3<T>::m() { }
template <typename T>
struct S4 {
void m() { }
};
extern template struct S4<int>;
void S4ImplicitInst() {
S4<int> s;
s.m();
}
struct S5 {
S5(int x);
};
struct TS5 {
S5 s;
template <typename T>
TS5(T y) : s(y) {}
};
// PR 8134
template<class T> void f_PR8134(T);
template<class T> void f_PR8134(T);
void g_PR8134() { f_PR8134(0); f_PR8134('x'); }
// rdar8580149
template <typename T>
struct S6;
template <typename T, unsigned N>
struct S6<const T [N]>
{
private:
typedef const T t1[N];
public:
typedef t1& t2;
};
template<typename T>
struct S7;
template<unsigned N>
struct S7<int[N]> : S6<const int[N]> { };
// Zero-length template argument lists
namespace ZeroLengthExplicitTemplateArgs {
template<typename T> void h();
struct Y {
template<typename T> void f();
};
template<typename T>
void f(T *ptr) {
T::template g<>(17);
ptr->template g2<>(17);
h<T>();
h<int>();
Y y;
y.f<int>();
}
struct X {
template<typename T> static void g(T);
template<typename T> void g2(T);
};
}
namespace NonTypeTemplateParmContext {
template<typename T, int inlineCapacity = 0> class Vector { };
struct String {
template<int inlineCapacity>
static String adopt(Vector<char, inlineCapacity>&);
};
template<int inlineCapacity>
inline bool equalIgnoringNullity(const Vector<char, inlineCapacity>& a, const String& b) { return false; }
}
// <rdar://problem/11112464>
template< typename > class Foo;
template< typename T >
class Foo : protected T
{
public:
Foo& operator=( const Foo& other );
};
template<typename...A> struct NestedExpansion {
template<typename...B> auto f(A...a, B...b) -> decltype(g(a + b...));
};
template struct NestedExpansion<char, char, char>;
namespace rdar13135282 {
template < typename _Alloc >
void foo(_Alloc = _Alloc());
template < bool > class __pool;
template < template < bool > class _PoolTp >
struct __common_pool {
typedef _PoolTp < 0 > pool_type;
};
template < template < bool > class _PoolTp >
struct __common_pool_base : __common_pool < _PoolTp > {};
template < template < bool > class _PoolTp >
struct A : __common_pool_base < _PoolTp > {};
template < typename _Poolp = A < __pool > >
struct __mt_alloc {
typedef typename _Poolp::pool_type __pool_type;
__mt_alloc() {
foo<__mt_alloc<> >();
}
};
}
namespace PR13020 {
template<typename T>
void f() {
enum E {
enumerator
};
T t = enumerator;
}
template void f<int>();
}
template<typename T> void doNotDeserialize() {}
template<typename T> struct ContainsDoNotDeserialize {
static int doNotDeserialize;
};
template<typename T> struct ContainsDoNotDeserialize2 {
static void doNotDeserialize();
};
template<typename T> int ContainsDoNotDeserialize<T>::doNotDeserialize = 0;
template<typename T> void ContainsDoNotDeserialize2<T>::doNotDeserialize() {}
template<typename T> void DependentSpecializedFunc(T x) { x.foo(); }
template<typename T> class DependentSpecializedFuncClass {
void foo() {}
friend void DependentSpecializedFunc<>(DependentSpecializedFuncClass);
};
namespace cyclic_module_load {
// Reduced from a libc++ modules crasher.
namespace std {
template<class> class mask_array;
template<class> class valarray {
public:
valarray(const valarray &v);
};
class gslice {
valarray<int> x;
valarray<int> stride() const { return x; }
};
template<class> class mask_array {
template<class> friend class valarray;
};
}
}
namespace local_extern {
template<typename T> int f() {
extern int arr[3];
{
extern T arr;
return sizeof(arr);
}
}
template<typename T> int g() {
extern int arr[3];
extern T arr;
return sizeof(arr);
}
}
namespace rdar15468709a {
template<typename> struct decay {};
template<typename FooParamTy> auto foo(FooParamTy fooParam) -> decltype(fooParam);
template<typename BarParamTy> auto bar(BarParamTy barParam) -> decay<decltype(barParam)>;
struct B {};
void crash() {
B some;
bar(some);
}
}
namespace rdar15468709b {
template<typename> struct decay {};
template<typename... Foos> int returnsInt(Foos... foos);
template<typename... FooParamTy> auto foo(FooParamTy... fooParam) -> decltype(returnsInt(fooParam...));
template<typename... BarParamTy> auto bar(BarParamTy... barParam) -> decay<decltype(returnsInt(barParam...))>;
struct B {};
void crash() {
B some;
bar(some);
}
}
namespace rdar15468709c {
template<typename> struct decay {};
template<class... Foos> int returnsInt(Foos... foos);
template<typename FooParamTy> void foo(FooParamTy fooParam) { decltype(fooParam) a; }
template<typename BarParamTy> auto bar(BarParamTy barParam) -> decay<decltype(barParam)>;
struct B {};
void crash() {
B some;
bar(some);
}
}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-variadic-templates.h
|
// PR9073
template<typename _Tp>
class shared_ptr{
public:
template<class _Alloc, class ..._Args>
static
shared_ptr<_Tp>
allocate_shared(const _Alloc& __a, _Args&& ...__args);
};
template<class _Tp>
template<class _Alloc, class ..._Args>
shared_ptr<_Tp>
shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args)
{
shared_ptr<_Tp> __r;
return __r;
}
template<typename...Ts> struct outer {
template<Ts...Vs, template<Ts> class ...Cs> struct inner {
inner(Cs<Vs>...);
};
};
template struct outer<int, int>;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/chain-friend-instantiation.cpp
|
// RUN: %clang_cc1 %s -ast-print -o - -chain-include %s -chain-include %s
// RUN: %clang_cc1 %s -ast-print -o - -fmodules -chain-include %s -chain-include %s
#if !defined(PASS1)
#define PASS1
template <class T> class TClass;
namespace NS {
template <class X, class Y> TClass<X> problematic(X * ptr, const TClass<Y> &src);
template <class T>
class TBaseClass
{
protected:
template <class X, class Y> friend TClass<X> problematic(X * ptr, const TClass<Y> &src);
};
}
template <class T>
class TClass: public NS::TBaseClass<T>
{
public:
inline TClass() { }
};
namespace NS {
template <class X, class T>
TClass<X> problematic(X *ptr, const TClass<T> &src);
}
template <class X, class T>
TClass<X> unconst(const TClass<T> &src);
#elif !defined(PASS2)
#define PASS2
namespace std {
class s {};
}
typedef TClass<std::s> TStr;
struct crash {
TStr str;
crash(const TClass<std::s> p)
{
unconst<TStr>(p);
}
};
#else
void f() {
const TStr p;
crash c(p);
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/missing-file.cpp
|
// Test reading of PCH without original input files.
// Generate the PCH, removing the original file:
// RUN: echo 'struct S{char c; int i; }; void foo() {}' > %t.h
// RUN: echo 'template <typename T> void tf() { T::foo(); }' >> %t.h
// RUN: %clang_cc1 -x c++ -emit-pch -o %t.h.pch %t.h
// %t.h might be touched by scanners as a hot file on Windows,
// to fail to remove %.h with single run.
// FIXME: Do we really want to work around bugs in virus checkers here?
// RUN: rm %t.h || rm %t.h || rm %t.h
// Check diagnostic with location in original source:
// RUN: not %clang_cc1 -include-pch %t.h.pch -emit-obj -o %t.o %s 2> %t.stderr
// RUN: grep 'could not find file' %t.stderr
void qq(S*) {}
#ifdef REDECL
float foo() {return 0f;}
#endif
#ifdef INSTANTIATION
void f() {
tf<int>();
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/floating-literal.c
|
// RUN: %clang_cc1 -triple mips64-none-linux-gnu -emit-pch -o %t %s
// REQUIRES: mips-registered-target
// RUN: %clang_cc1 -x ast -ast-print %t | FileCheck %s
// Make sure the semantics of FloatingLiterals are stored correctly in
// the AST. Previously, the ASTWriter didn't store anything and the
// reader assumed PPC 128-bit float semantics, which is incorrect for
// targets with 128-bit IEEE long doubles.
long double foo = 1.0E4000L;
// CHECK: long double foo = 1.00000000000000000000000000000000004E+4000L;
// Just as well check the others are still sane while we're here...
double bar = 1.0E300;
// CHECK: double bar = 1.0000000000000001E+300;
float wibble = 1.0E40;
// CHECK: float wibble = 1.0E+40;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/multiple_decls.c
|
// Test this without pch.
// RUN: %clang_cc1 -include %S/multiple_decls.h -fsyntax-only -ast-print -o - %s
// Test with pch.
// RUN: %clang_cc1 -emit-pch -o %t %S/multiple_decls.h
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -ast-print -o - %s
void f0(char c) {
wide(c);
}
struct wide w;
struct narrow n;
void f1(int i) {
narrow(i);
}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-offsetof-base.cpp
|
// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-offsetof-base.h
// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/asm.h
|
// Header for the PCH test asm.c
void f() {
int i;
asm ("foo\n" : : "a" (i + 2));
asm ("foo\n" : [symbolic_name] "=a" (i) : "[symbolic_name]" (i));
}
void clobbers() {
asm ("nop" : : : "ax", "#ax", "%ax");
asm ("nop" : : : "eax", "rax", "ah", "al");
asm ("nop" : : : "0", "%0", "#0");
}
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/struct.c
|
// Test this without pch.
// RUN: %clang_cc1 -include %S/struct.h -fsyntax-only -verify %s
// Test with pch.
// RUN: %clang_cc1 -emit-pch -o %t %S/struct.h
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
struct Point *p1;
float getX(struct Point *p1) {
return p1->x;
}
void *get_fun_ptr() {
return fun->is_ptr? fun->ptr : 0;
}
struct Fun2 {
int very_fun;
};
int get_very_fun() {
return fun2->very_fun;
}
int *int_ptr_fail = &fun->is_ptr; // expected-error{{address of bit-field requested}}
struct Nested nested = { 1, 2 };
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/namespaces.cpp
|
// Test this without pch.
// RUN: %clang_cc1 -x c++ -include %S/Inputs/namespaces.h -fsyntax-only %s
// Test with pch.
// RUN: %clang_cc1 -x c++ -emit-pch -o %t %S/Inputs/namespaces.h
// RUN: %clang_cc1 -x c++ -include-pch %t -fsyntax-only %s
int int_val;
N1::t1 *ip1 = &int_val;
N1::t2 *ip2 = &int_val;
N2::Inner::t3 *ip3 = &int_val;
float float_val;
namespace N2 { }
N2::t1 *fp1 = &float_val;
Alias1::t3 *ip4 = &int_val;
t3 *ip5 = &int_val;
void(*funp1)() = anon;
namespace {
class C;
}
C* cp1;
namespace N3 {
namespace {
class C;
}
}
N3::C *cp2;
void(*funp2)() = ext;
using N1::used_func;
void (*pused)() = used_func;
using N1::used_cls;
used_cls s1;
used_cls* ps1 = &s1;
inline namespace N4 { }
struct MemberOfN4 *mn4;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/objc_boxable_record.h
|
// used with objc_boxable.m test
struct boxable {
int dummy;
};
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/functions.h
|
/* For use with the functions.c test */
int f0(int x, int y, ...);
float *f1(float x, float y);
void g0(int *);
void do_abort(int) __attribute__((noreturn));
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/captured-stmt.cpp
|
// RUN: %clang_cc1 -x c++-header -emit-pch %s -o %t
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
// expected-no-diagnostics
#ifndef HEADER_INCLUDED
#define HEADER_INCLUDED
static inline void foo(int &x, int y) {
// Capturing x and y
#pragma clang __debug captured
{
x += y;
}
}
struct C {
int val;
explicit C(int v) : val(v) { }
void bar(int &x) {
// Capturing x and this
#pragma clang __debug captured
{
x += val;
}
}
};
#else
void test_foo(int &x) {
foo(x, 10);
}
void test_bar(int &x) {
C Obj(10);
Obj.bar(x);
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx-namespaces.cpp
|
// Test this without pch.
// RUN: %clang_cc1 -include %S/cxx-namespaces.h -fsyntax-only -verify %s
// Test with pch.
// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-namespaces.h
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -ast-dump-lookups -ast-dump-filter N %s | FileCheck %s
// Test with modules.
// RUN: %clang_cc1 -fmodules -x c++-header -emit-pch -o %t %S/cxx-namespaces.h
// RUN: %clang_cc1 -fmodules -include-pch %t -fsyntax-only -verify %s
// RUN: %clang_cc1 -fmodules -include-pch %t -fsyntax-only -ast-dump-lookups -ast-dump-filter N %s | FileCheck %s
// expected-no-diagnostics
void m() {
N::x = 0;
N::f();
}
// namespace 'N' should contain only two declarations of 'f'.
// CHECK: DeclarationName 'f'
// CHECK-NEXT: |-Function {{.*}} 'f' 'void (
// CHECK-NEXT: `-Function {{.*}} 'f' 'void (
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/preamble.c
|
// Check that using the preamble option actually skips the preamble.
// RUN: %clang_cc1 -emit-pch -o %t %S/Inputs/preamble.h -DFOO=f
// RUN: not %clang_cc1 -include-pch %t -preamble-bytes=317,1 -DFOO=f -verify %s -emit-llvm -o - | FileCheck %s
float f(int); // Not an error, because we skip this via the preamble!
int g(int x) {
return FOO(x);
}
// CHECK: call {{.*}} @f(
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/ext_vector.h
|
// Header file for ext_vector.c PCH test
typedef __attribute__((ext_vector_type(2))) float float2;
typedef __attribute__((ext_vector_type(4))) float float4;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/pch-dir.h
|
#ifdef __cplusplus
extern int i;
#else
extern int j;
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/emit-pth.c
|
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-pth -o %t1 %s
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-pth -o - %s > %t2
// RUN: cmp %t1 %t2
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-pth -o - %s | \
// RUN: FileCheck %s
// CHECK: cfe-pth
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/enum.h
|
/* Used in enum.c test */
enum Color {
Red,
Green,
Blue
};
enum Shape {
Square,
Triangle = 17,
Rhombus,
Circle
};
enum Shape aRoundShape = Circle;
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/cxx11-exception-spec.cpp
|
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t.1
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t.1 -emit-pch %s -o %t.2
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t.2 -verify %s
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t.2 -emit-llvm-only %s
// expected-no-diagnostics
#ifndef PHASE1_DONE
#define PHASE1_DONE
template<int n> int f() noexcept(n % 2) { return 0; }
template<int n> int g() noexcept(n % 2);
decltype(f<2>()) f0;
decltype(f<3>()) f1;
template int f<4>();
template int f<5>();
decltype(f<6>()) f6;
decltype(f<7>()) f7;
struct A {
A();
A(const A&);
};
decltype(g<0>()) g0;
#elif !defined(PHASE2_DONE)
#define PHASE2_DONE
template int f<6>();
template int f<7>();
decltype(f<8>()) f8;
decltype(f<9>()) f9;
template int f<10>();
template int f<11>();
A::A() = default;
A::A(const A&) = default;
int g0val = g<0>();
#else
static_assert(!noexcept(f<0>()), "");
static_assert(noexcept(f<1>()), "");
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/pragma-loop.cpp
|
// RUN: %clang_cc1 -emit-pch -o %t.a %s
// RUN: %clang_cc1 -include-pch %t.a %s -ast-print -o - | FileCheck %s
// FIXME: A bug in ParsedAttributes causes the order of the attributes to be
// reversed. The checks are consequently in the reverse order below.
// CHECK: #pragma clang loop unroll_count(16)
// CHECK: #pragma clang loop interleave_count(8)
// CHECK: #pragma clang loop vectorize_width(4)
// CHECK: #pragma clang loop unroll(disable)
// CHECK: #pragma clang loop interleave(disable)
// CHECK: #pragma clang loop vectorize(enable)
// CHECK: #pragma clang loop unroll(full)
// CHECK: #pragma clang loop interleave(enable)
// CHECK: #pragma clang loop vectorize(disable)
// CHECK: #pragma unroll
// CHECK: #pragma unroll (32)
// CHECK: #pragma nounroll
// CHECK: #pragma clang loop interleave_count(I)
// CHECK: #pragma clang loop vectorize_width(V)
#ifndef HEADER
#define HEADER
class pragma_test {
public:
inline void run1(int *List, int Length) {
int i = 0;
#pragma clang loop vectorize_width(4)
#pragma clang loop interleave_count(8)
#pragma clang loop unroll_count(16)
while (i < Length) {
List[i] = i;
i++;
}
}
inline void run2(int *List, int Length) {
int i = 0;
#pragma clang loop vectorize(enable)
#pragma clang loop interleave(disable)
#pragma clang loop unroll(disable)
while (i - 1 < Length) {
List[i] = i;
i++;
}
}
inline void run3(int *List, int Length) {
int i = 0;
#pragma clang loop vectorize(disable)
#pragma clang loop interleave(enable)
#pragma clang loop unroll(full)
while (i - 3 < Length) {
List[i] = i;
i++;
}
}
inline void run4(int *List, int Length) {
int i = 0;
#pragma unroll
while (i - 3 < Length) {
List[i] = i;
i++;
}
}
inline void run5(int *List, int Length) {
int i = 0;
#pragma unroll 32
while (i - 3 < Length) {
List[i] = i;
i++;
}
}
inline void run6(int *List, int Length) {
int i = 0;
#pragma nounroll
while (i - 3 < Length) {
List[i] = i;
i++;
}
}
template <int V, int I>
inline void run7(int *List, int Length) {
#pragma clang loop vectorize_width(V)
#pragma clang loop interleave_count(I)
for (int i = 0; i < Length; i++) {
List[i] = i;
}
}
};
#else
void test() {
int List[100];
pragma_test pt;
pt.run1(List, 100);
pt.run2(List, 100);
pt.run3(List, 100);
pt.run4(List, 100);
pt.run5(List, 100);
pt.run6(List, 100);
pt.run7<2, 4>(List, 100);
}
#endif
|
0 |
repos/DirectXShaderCompiler/tools/clang/test
|
repos/DirectXShaderCompiler/tools/clang/test/PCH/target-options.h
|
enum { apple_cc = __APPLE_CC__ };
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.