diff options
author | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
---|---|---|
committer | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
commit | 222e2a7620e6520ffaf4fc4e69d79c18da31542e (patch) | |
tree | 7bfbc05bfa3b41c8f9d2e56d53a0bc3e310df239 /clang/test/Index/Inputs | |
parent | 3d206f03985b50beacae843d880bccdc91a9f424 (diff) |
Add the clang library to the repo (with some of my changes, too).
Diffstat (limited to 'clang/test/Index/Inputs')
35 files changed, 245 insertions, 0 deletions
diff --git a/clang/test/Index/Inputs/Frameworks/Framework.framework/Headers/Framework.h b/clang/test/Index/Inputs/Frameworks/Framework.framework/Headers/Framework.h new file mode 100644 index 0000000..3e3830a --- /dev/null +++ b/clang/test/Index/Inputs/Frameworks/Framework.framework/Headers/Framework.h @@ -0,0 +1,2 @@ +int *getFrameworkVersion(); + diff --git a/clang/test/Index/Inputs/Headers/a.h b/clang/test/Index/Inputs/Headers/a.h new file mode 100644 index 0000000..33c3417 --- /dev/null +++ b/clang/test/Index/Inputs/Headers/a.h @@ -0,0 +1,2 @@ +int *getA(); + diff --git a/clang/test/Index/Inputs/Headers/a_extensions.h b/clang/test/Index/Inputs/Headers/a_extensions.h new file mode 100644 index 0000000..2155787 --- /dev/null +++ b/clang/test/Index/Inputs/Headers/a_extensions.h @@ -0,0 +1 @@ +int *getAExtensions(); diff --git a/clang/test/Index/Inputs/Headers/crash.h b/clang/test/Index/Inputs/Headers/crash.h new file mode 100644 index 0000000..238359a --- /dev/null +++ b/clang/test/Index/Inputs/Headers/crash.h @@ -0,0 +1,6 @@ +// Produce a crash if CRASH is defined. +#ifdef CRASH +# pragma clang __debug crash +#endif + +const char *getCrashString(); diff --git a/clang/test/Index/Inputs/Headers/module.map b/clang/test/Index/Inputs/Headers/module.map new file mode 100644 index 0000000..55f8eb7 --- /dev/null +++ b/clang/test/Index/Inputs/Headers/module.map @@ -0,0 +1,10 @@ +module LibA { + header "a.h" + module Extensions { + header "a_extensions.h" + } +} + +module Crash { + header "crash.h" +} diff --git a/clang/test/Index/Inputs/Headers/nested/module.map b/clang/test/Index/Inputs/Headers/nested/module.map new file mode 100644 index 0000000..bd239f1 --- /dev/null +++ b/clang/test/Index/Inputs/Headers/nested/module.map @@ -0,0 +1,4 @@ +module nested { + header "nested.h" +} + diff --git a/clang/test/Index/Inputs/Headers/nested/nested.h b/clang/test/Index/Inputs/Headers/nested/nested.h new file mode 100644 index 0000000..01716d1 --- /dev/null +++ b/clang/test/Index/Inputs/Headers/nested/nested.h @@ -0,0 +1 @@ +int *getNested(); diff --git a/clang/test/Index/Inputs/a.h b/clang/test/Index/Inputs/a.h new file mode 100644 index 0000000..70ace8c --- /dev/null +++ b/clang/test/Index/Inputs/a.h @@ -0,0 +1,4 @@ +#ifndef A_H +#define A_H +typedef int A; +#endif diff --git a/clang/test/Index/Inputs/b.h b/clang/test/Index/Inputs/b.h new file mode 100644 index 0000000..02591d2 --- /dev/null +++ b/clang/test/Index/Inputs/b.h @@ -0,0 +1 @@ +typedef float B; diff --git a/clang/test/Index/Inputs/c-index-pch.h b/clang/test/Index/Inputs/c-index-pch.h new file mode 100644 index 0000000..6dda180 --- /dev/null +++ b/clang/test/Index/Inputs/c-index-pch.h @@ -0,0 +1,7 @@ +#ifndef C_INDEX_PCH_H +#define C_INDEX_PCH_H + +void foo(int i, float f); +extern int bar; + +#endif // C_INDEX_PCH_H diff --git a/clang/test/Index/Inputs/cindex-from-source.h b/clang/test/Index/Inputs/cindex-from-source.h new file mode 100644 index 0000000..d13d397 --- /dev/null +++ b/clang/test/Index/Inputs/cindex-from-source.h @@ -0,0 +1 @@ +typedef int t0; diff --git a/clang/test/Index/Inputs/complete-pch.h b/clang/test/Index/Inputs/complete-pch.h new file mode 100644 index 0000000..ddf5253 --- /dev/null +++ b/clang/test/Index/Inputs/complete-pch.h @@ -0,0 +1,10 @@ +@interface A +- (int)instanceMethod1:(int)x; ++ (int)classMethod1:(double)d; +@end + +@interface B +- (int)instanceMethod2:(int)x; ++ (int)classMethod2:(float)f; +@end + diff --git a/clang/test/Index/Inputs/crash-recovery-code-complete-remap.c b/clang/test/Index/Inputs/crash-recovery-code-complete-remap.c new file mode 100644 index 0000000..50a8658 --- /dev/null +++ b/clang/test/Index/Inputs/crash-recovery-code-complete-remap.c @@ -0,0 +1,12 @@ +// RUN: echo env CINDEXTEST_EDITING=1 \ +// RUN: not c-index-test -test-load-source-reparse 1 local \ +// RUN: -remap-file="%s;%S/Inputs/crash-recovery-code-complete-remap.c" \ +// RUN: %s 2> %t.err +// RUN: FileCheck < %t.err -check-prefix=CHECK-CODE-COMPLETE-CRASH %s +// CHECK-CODE-COMPLETE-CRASH: Unable to reparse translation unit +// +// XFAIL: win32 + +#warning parsing original file + +#pragma clang __debug crash diff --git a/clang/test/Index/Inputs/crash-recovery-reparse-remap.c b/clang/test/Index/Inputs/crash-recovery-reparse-remap.c new file mode 100644 index 0000000..0357dbe --- /dev/null +++ b/clang/test/Index/Inputs/crash-recovery-reparse-remap.c @@ -0,0 +1,11 @@ + +#warning parsing remapped file + + + +int x; + +#pragma clang __debug crash + +int x; + diff --git a/clang/test/Index/Inputs/foo.h b/clang/test/Index/Inputs/foo.h new file mode 100644 index 0000000..7670c00 --- /dev/null +++ b/clang/test/Index/Inputs/foo.h @@ -0,0 +1,8 @@ +extern int global_var; + +void foo_func(int param1); +void bar_func(void); + +struct MyStruct { + int field_var; +}; diff --git a/clang/test/Index/Inputs/get-cursor-includes-1.h b/clang/test/Index/Inputs/get-cursor-includes-1.h new file mode 100644 index 0000000..48439d2 --- /dev/null +++ b/clang/test/Index/Inputs/get-cursor-includes-1.h @@ -0,0 +1,6 @@ +#ifndef GET_CURSOR_INCLUDES_1_H +#define GET_CURSOR_INCLUDES_1_H + +extern int blah; + +#endif // GET_CURSOR_INCLUDES_1_H diff --git a/clang/test/Index/Inputs/get-cursor-includes-2.h b/clang/test/Index/Inputs/get-cursor-includes-2.h new file mode 100644 index 0000000..cf95c18 --- /dev/null +++ b/clang/test/Index/Inputs/get-cursor-includes-2.h @@ -0,0 +1,2 @@ +#include "get-cursor-includes-1.h" +#include "get-cursor-includes-1.h" diff --git a/clang/test/Index/Inputs/guarded.h b/clang/test/Index/Inputs/guarded.h new file mode 100644 index 0000000..0a1a6ac --- /dev/null +++ b/clang/test/Index/Inputs/guarded.h @@ -0,0 +1,6 @@ +#ifndef GUARDED_HEADER_H +#define GUARDED_HEADER_H + +int y; + +#endif // GUARDED_HEADER_H diff --git a/clang/test/Index/Inputs/lit.local.cfg b/clang/test/Index/Inputs/lit.local.cfg new file mode 100644 index 0000000..e6f55ee --- /dev/null +++ b/clang/test/Index/Inputs/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = [] diff --git a/clang/test/Index/Inputs/objc.h b/clang/test/Index/Inputs/objc.h new file mode 100644 index 0000000..c671add --- /dev/null +++ b/clang/test/Index/Inputs/objc.h @@ -0,0 +1,11 @@ +@interface Base { + int my_var; +} +-(int) my_var; +-(void) my_method: (int)param; ++(void) my_method: (int)param; +@end + +@interface Sub : Base +-(void) my_method: (int)param; +@end diff --git a/clang/test/Index/Inputs/pragma-once.h b/clang/test/Index/Inputs/pragma-once.h new file mode 100644 index 0000000..503cb3f --- /dev/null +++ b/clang/test/Index/Inputs/pragma-once.h @@ -0,0 +1,3 @@ +#pragma once +int i; + diff --git a/clang/test/Index/Inputs/pragma_disable_warning.h b/clang/test/Index/Inputs/pragma_disable_warning.h new file mode 100644 index 0000000..b40e9e7 --- /dev/null +++ b/clang/test/Index/Inputs/pragma_disable_warning.h @@ -0,0 +1 @@ +#pragma clang diagnostic ignored "-Wunused-parameter" diff --git a/clang/test/Index/Inputs/preamble-reparse-1.c b/clang/test/Index/Inputs/preamble-reparse-1.c new file mode 100644 index 0000000..139597f --- /dev/null +++ b/clang/test/Index/Inputs/preamble-reparse-1.c @@ -0,0 +1,2 @@ + + diff --git a/clang/test/Index/Inputs/preamble-reparse-2.c b/clang/test/Index/Inputs/preamble-reparse-2.c new file mode 100644 index 0000000..6d1a0d4 --- /dev/null +++ b/clang/test/Index/Inputs/preamble-reparse-2.c @@ -0,0 +1 @@ +int x; diff --git a/clang/test/Index/Inputs/preamble.h b/clang/test/Index/Inputs/preamble.h new file mode 100644 index 0000000..b59c234 --- /dev/null +++ b/clang/test/Index/Inputs/preamble.h @@ -0,0 +1,6 @@ +inline int bar(int i) { + int *ptr = 0; + float *ptr1; + ptr = ptr1; + return 0; +} diff --git a/clang/test/Index/Inputs/preamble_macro_template.h b/clang/test/Index/Inputs/preamble_macro_template.h new file mode 100644 index 0000000..18b076d --- /dev/null +++ b/clang/test/Index/Inputs/preamble_macro_template.h @@ -0,0 +1,6 @@ +#define STATIC_CAST static_cast + +template<typename T> +void foo(T *p) { + (void)STATIC_CAST<T*>(0); +} diff --git a/clang/test/Index/Inputs/prefix.h b/clang/test/Index/Inputs/prefix.h new file mode 100644 index 0000000..82ba2da --- /dev/null +++ b/clang/test/Index/Inputs/prefix.h @@ -0,0 +1,4 @@ +#ifndef PREFIX_H +#define PREFIX_H +int foo(int); +#endif diff --git a/clang/test/Index/Inputs/redeclarations.h b/clang/test/Index/Inputs/redeclarations.h new file mode 100644 index 0000000..7f0d7ae --- /dev/null +++ b/clang/test/Index/Inputs/redeclarations.h @@ -0,0 +1,21 @@ +class X +{ + friend class A; +}; + + +template <typename T1, typename T2> +class B +{ +}; + +template <class T> +struct C +{ +}; + +class D +{ + B<D, class A> x; + friend struct C<A>; +}; diff --git a/clang/test/Index/Inputs/remap-complete-to.c b/clang/test/Index/Inputs/remap-complete-to.c new file mode 100644 index 0000000..30199db --- /dev/null +++ b/clang/test/Index/Inputs/remap-complete-to.c @@ -0,0 +1,6 @@ +int f0(int *pointer1, float *pointer2) { + return pointer2 - pointer1; +} + +void g() { + diff --git a/clang/test/Index/Inputs/remap-load-to.c b/clang/test/Index/Inputs/remap-load-to.c new file mode 100644 index 0000000..8f9e1eb --- /dev/null +++ b/clang/test/Index/Inputs/remap-load-to.c @@ -0,0 +1,3 @@ +int foo(int parm1, float parm2) { + return parm1 + parm2; +} diff --git a/clang/test/Index/Inputs/reparse-instantiate.h b/clang/test/Index/Inputs/reparse-instantiate.h new file mode 100644 index 0000000..df90a6d --- /dev/null +++ b/clang/test/Index/Inputs/reparse-instantiate.h @@ -0,0 +1,14 @@ +template <typename T> struct S; + +template<typename T> void c(T) +{ +} + +template <> struct S <int> +{ + void a() + { + c(&S<int>::b); + } + void b() {} +}; diff --git a/clang/test/Index/Inputs/t1.c b/clang/test/Index/Inputs/t1.c new file mode 100644 index 0000000..ceaad4c --- /dev/null +++ b/clang/test/Index/Inputs/t1.c @@ -0,0 +1,28 @@ +#include "foo.h" + +void foo_func(int param1) { + int local_var = global_var; + for (int for_var = 100; for_var < 500; ++for_var) { + local_var = param1 + for_var; + } + bar_func(); +} + +struct S1 { + int x; +}; + +struct S2 { + int x; +}; + +void field_test(void) { + struct S1 s1; + s1.x = 0; + ((struct S2 *)0)->x = 0; + + struct MyStruct ms; + ms.field_var = 10; +} + +int (^CP)(int) = ^(int x) { return x * global_var; }; diff --git a/clang/test/Index/Inputs/t1.m b/clang/test/Index/Inputs/t1.m new file mode 100644 index 0000000..b7c86cd --- /dev/null +++ b/clang/test/Index/Inputs/t1.m @@ -0,0 +1,20 @@ +#include "objc.h" + +static void foo() { + Base *base; + int x = [base my_var]; + [base my_method:x]; + [Base my_method:x]; +} + +@implementation Base +-(int) my_var { + return my_var; +} + +-(void) my_method: (int)param { +} + ++(void) my_method: (int)param { +} +@end diff --git a/clang/test/Index/Inputs/t2.c b/clang/test/Index/Inputs/t2.c new file mode 100644 index 0000000..76d5d6c --- /dev/null +++ b/clang/test/Index/Inputs/t2.c @@ -0,0 +1,11 @@ +#include "foo.h" + +int global_var = 10; + +void bar_func(void) { + global_var += 100; + foo_func(global_var); + + struct MyStruct *ms; + ms->field_var = 10; +} diff --git a/clang/test/Index/Inputs/t2.m b/clang/test/Index/Inputs/t2.m new file mode 100644 index 0000000..3f103ee --- /dev/null +++ b/clang/test/Index/Inputs/t2.m @@ -0,0 +1,13 @@ +#include "objc.h" + +static void foo() { + Sub *sub; + int x = [sub my_var]; + [sub my_method:x]; + [Sub my_method:x]; +} + +@implementation Sub +-(void) my_method: (int)param { +} +@end |