From 3e8efd9801889ee46c5c3e3a4e745446fd30b752 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 21 Jul 2009 00:06:46 +0000 Subject: [PATCH] Use temporary output to avoid running index-test with the same commands multiple times. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76513 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGenObjC/object-incr-decr-1.ll | 60 ++++++++++++++++++++++++++ test/Index/comments.c | 30 +++++++------ test/Index/cxx-operator-overload.cpp | 15 ++++--- test/Index/find-decls.c | 32 +++++++++----- test/Index/find-defs.c | 24 +++++++---- test/Index/find-refs.c | 56 +++++++++++++++--------- test/Index/resolve-loc.c | 13 ++++-- 7 files changed, 168 insertions(+), 62 deletions(-) create mode 100644 test/CodeGenObjC/object-incr-decr-1.ll diff --git a/test/CodeGenObjC/object-incr-decr-1.ll b/test/CodeGenObjC/object-incr-decr-1.ll new file mode 100644 index 0000000000..825338cd0b --- /dev/null +++ b/test/CodeGenObjC/object-incr-decr-1.ll @@ -0,0 +1,60 @@ +; ModuleID = '/Users/argiris/proj/llvm/tools/clang/test/CodeGenObjC/object-incr-decr-1.m' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin9" +module asm "" +module asm "" + type opaque ; type %0 + %struct._objc_cache = type opaque + %struct._objc_category = type { i8*, i8*, %struct._objc_method_list*, %struct._objc_method_list*, %struct._objc_protocol_list*, i32, %struct._prop_list_t* } + %struct._objc_class = type { %struct._objc_class*, %struct._objc_class*, i8*, i32, i32, i32, %struct._objc_ivar_list*, %struct._objc_method_list*, %struct._objc_cache*, %struct._objc_protocol_list*, i8*, %struct._objc_class_extension* } + %struct._objc_class_extension = type { i32, i8*, %struct._prop_list_t* } + %struct._objc_exception_data = type { [18 x i32], [4 x i8*] } + %struct._objc_ivar = type { i8*, i8*, i32 } + %struct._objc_ivar_list = type opaque + %struct._objc_method = type { %struct.objc_selector*, i8*, i8* } + %struct._objc_method_description = type { %struct.objc_selector*, i8* } + %struct._objc_method_description_list = type { i32, [0 x %struct._objc_method_description] } + %struct._objc_method_list = type opaque + %struct._objc_module = type { i32, i32, i8*, %struct._objc_symtab* } + %struct._objc_protocol = type { %struct._objc_protocol_extension*, i8*, %struct._objc_protocol_list*, %struct._objc_method_description_list*, %struct._objc_method_description_list* } + %struct._objc_protocol_extension = type { i32, %struct._objc_method_description_list*, %struct._objc_method_description_list*, %struct._prop_list_t* } + %struct._objc_protocol_list = type { %struct._objc_protocol_list*, i32, [0 x %struct._objc_protocol] } + %struct._objc_super = type <{ i8*, i8* }> + %struct._objc_symtab = type { i32, %struct.objc_selector*, i16, i16, [0 x i8*] } + %struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] } + %struct._prop_t = type { i8*, i8* } + %struct.objc_selector = type opaque +@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__OBJC, __image_info,regular" ; <[2 x i32]*> [#uses=1] +@"\01L_OBJC_CLASS_NAME_" = internal global [1 x i8] zeroinitializer, section "__TEXT,__cstring,cstring_literals", align 1 ; <[1 x i8]*> [#uses=1] +@"\01L_OBJC_MODULES" = internal global %struct._objc_module { i32 7, i32 16, i8* getelementptr ([1 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct._objc_symtab* null }, section "__OBJC,__module_info,regular,no_dead_strip", align 4 ; <%struct._objc_module*> [#uses=1] +@llvm.used = appending global [3 x i8*] [i8* bitcast ([2 x i32]* @"\01L_OBJC_IMAGE_INFO" to i8*), i8* getelementptr ([1 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), i8* bitcast (%struct._objc_module* @"\01L_OBJC_MODULES" to i8*)], section "llvm.metadata" ; <[3 x i8*]*> [#uses=0] + +define %0* @foo() nounwind { +entry: + %retval = alloca %0* ; <%0**> [#uses=2] + %f = alloca %0*, align 4 ; <%0**> [#uses=9] + %tmp = load %0** %f ; <%0*> [#uses=1] + %0 = bitcast %0* %tmp to i8* ; [#uses=1] + %add.ptr = getelementptr i8* %0, i32 24 ; [#uses=1] + %1 = bitcast %0** %f to i8** ; [#uses=1] + store i8* %add.ptr, i8** %1 + %tmp1 = load %0** %f ; <%0*> [#uses=1] + %2 = bitcast %0* %tmp1 to i8* ; [#uses=1] + %add.ptr2 = getelementptr i8* %2, i32 -24 ; [#uses=1] + %3 = bitcast %0** %f to i8** ; [#uses=1] + store i8* %add.ptr2, i8** %3 + %tmp3 = load %0** %f ; <%0*> [#uses=1] + %4 = bitcast %0* %tmp3 to i8* ; [#uses=1] + %add.ptr4 = getelementptr i8* %4, i32 -24 ; [#uses=1] + %5 = bitcast %0** %f to i8** ; [#uses=1] + store i8* %add.ptr4, i8** %5 + %tmp5 = load %0** %f ; <%0*> [#uses=1] + %6 = bitcast %0* %tmp5 to i8* ; [#uses=1] + %add.ptr6 = getelementptr i8* %6, i32 24 ; [#uses=1] + %7 = bitcast %0** %f to i8** ; [#uses=1] + store i8* %add.ptr6, i8** %7 + %tmp7 = load %0** %f ; <%0*> [#uses=1] + store %0* %tmp7, %0** %retval + %8 = load %0** %retval ; <%0*> [#uses=1] + ret %0* %8 +} diff --git a/test/Index/comments.c b/test/Index/comments.c index 7ad8fd7e1f..689ce88e22 100644 --- a/test/Index/comments.c +++ b/test/Index/comments.c @@ -1,15 +1,4 @@ -// RUN: clang-cc -emit-pch -o %t.ast %s && -// RUN: index-test %t.ast -point-at %s:22:6 | grep "starts here" && -// RUN: index-test %t.ast -point-at %s:22:6 | grep "block comment" && -// RUN: index-test %t.ast -point-at %s:28:6 | grep "BCPL" && -// RUN: index-test %t.ast -point-at %s:28:6 | grep "But" && -// RUN: index-test %t.ast -point-at %s:28:6 | grep "NOT" | count 0 && -// RUN: index-test %t.ast -point-at %s:30:6 | grep "member" - - - - - +// Run lines are sensitive to line numbers and come below the code. //! It all starts here. /*! It's a little odd to continue line this, @@ -27,4 +16,19 @@ void f(int, int); /** But there are other blocks that are part of the comment, too. */ void g(int); -void h(int); ///< This is a member comment. \ No newline at end of file +void h(int); ///< This is a member comment. + + +// RUN: clang-cc -emit-pch -o %t.ast %s && + +// RUN: index-test %t.ast -point-at %s:11:6 > %t && +// RUN: grep "starts here" %t && +// RUN: grep "block comment" %t && + +// RUN: index-test %t.ast -point-at %s:17:6 > %t && +// RUN: grep "BCPL" %t && +// RUN: grep "But" %t && + +// RUN: index-test %t.ast -point-at %s:19:6 > %t && +// RUN: grep "NOT" %t | count 0 && +// RUN: grep "member" %t diff --git a/test/Index/cxx-operator-overload.cpp b/test/Index/cxx-operator-overload.cpp index 935f661cce..ffea76662d 100644 --- a/test/Index/cxx-operator-overload.cpp +++ b/test/Index/cxx-operator-overload.cpp @@ -14,11 +14,14 @@ Cls Cls::operator +(const Cls &RHS) { } // RUN: clang-cc -emit-pch %s -o %t.ast && -// RUN: index-test %t.ast -point-at %s:10:17 -print-decls | count 2 && -// RUN: index-test %t.ast -point-at %s:10:17 -print-decls | grep ':5:9,' && -// RUN: index-test %t.ast -point-at %s:10:17 -print-decls | grep ':13:10,' && + +// RUN: index-test %t.ast -point-at %s:10:17 -print-decls > %t && +// RUN: cat %t | count 2 && +// RUN: grep ':5:9,' %t && +// RUN: grep ':13:10,' %t && // Yep, we can show references of '+' plus signs that are overloaded, w00t! -// RUN: index-test %t.ast -point-at %s:5:15 -print-refs | count 2 && -// RUN: index-test %t.ast -point-at %s:5:15 -print-refs | grep ':10:17,' && -// RUN: index-test %t.ast -point-at %s:5:15 -print-refs | grep ':10:22,' +// RUN: index-test %t.ast -point-at %s:5:15 -print-refs > %t && +// RUN: cat %t | count 2 && +// RUN: grep ':10:17,' %t && +// RUN: grep ':10:22,' %t diff --git a/test/Index/find-decls.c b/test/Index/find-decls.c index 1fb1a65251..425c89d3e2 100644 --- a/test/Index/find-decls.c +++ b/test/Index/find-decls.c @@ -1,15 +1,25 @@ // RUN: clang-cc -emit-pch %S/t1.c -o %t1.ast && // RUN: clang-cc -emit-pch %S/t2.c -o %t2.ast && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-decls | count 3 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-decls | grep 'foo.h:4:6,' | count 2 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-decls | grep 't2.c:5:6,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:47 -print-decls | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:47 -print-decls | grep 't1.c:5:12,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:6:20 -print-decls | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:6:20 -print-decls | grep 't1.c:3:19,' && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-decls > %t && +// RUN: cat %t | count 3 && +// RUN: grep 'foo.h:4:6,' %t | count 2 && +// RUN: grep 't2.c:5:6,' %t && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:47 -print-decls > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't1.c:5:12,' %t && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:6:20 -print-decls > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't1.c:3:19,' %t && // field test -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:21:6 -print-decls | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:21:6 -print-decls | grep 't1.c:12:7,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:22:21 -print-decls | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:22:21 -print-decls | grep 't1.c:16:7,' + +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:21:6 -print-decls > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't1.c:12:7,' %t && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:22:21 -print-decls > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't1.c:16:7,' %t diff --git a/test/Index/find-defs.c b/test/Index/find-defs.c index 5e034bbec6..3dc635b272 100644 --- a/test/Index/find-defs.c +++ b/test/Index/find-defs.c @@ -1,10 +1,18 @@ // RUN: clang-cc -emit-pch %S/t1.c -o %t1.ast && // RUN: clang-cc -emit-pch %S/t2.c -o %t2.ast && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-defs | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-defs | grep 't2.c:3:5,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:3:9 -print-defs | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:3:9 -print-defs | grep 't1.c:3:6,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:4:9 -print-defs | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:4:9 -print-defs | grep 't2.c:5:6,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-defs | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-defs | grep 't2.c:5:6,' + +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-defs > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't2.c:3:5,' %t && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:3:9 -print-defs > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't1.c:3:6,' %t && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:4:9 -print-defs > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't2.c:5:6,' %t && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:8:7 -print-defs > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't2.c:5:6,' %t diff --git a/test/Index/find-refs.c b/test/Index/find-refs.c index 7f00bcf24e..5212c24695 100644 --- a/test/Index/find-refs.c +++ b/test/Index/find-refs.c @@ -1,25 +1,41 @@ // RUN: clang-cc -emit-pch %S/t1.c -o %t1.ast && // RUN: clang-cc -emit-pch %S/t2.c -o %t2.ast && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-refs | count 3 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-refs | grep 't1.c:4:19,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-refs | grep 't2.c:6:3,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-refs | grep 't2.c:7:12,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:3:9 -print-refs | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:3:9 -print-refs | grep 't2.c:7:3,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:4:9 -print-refs | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:4:9 -print-refs | grep 't1.c:8:3,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:3:22 -print-refs | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:3:22 -print-refs | grep 't1.c:6:17,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:4:11 -print-refs | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:4:11 -print-refs | grep 't1.c:6:5,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:30 -print-refs | count 3 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:30 -print-refs | grep 't1.c:5:27,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:30 -print-refs | grep 't1.c:5:44,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:30 -print-refs | grep 't1.c:6:26,' && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:1:14 -print-refs > %t && +// RUN: cat %t | count 3 && +// RUN: grep 't1.c:4:19,' %t && +// RUN: grep 't2.c:6:3,' %t && +// RUN: grep 't2.c:7:12,' %t && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:3:9 -print-refs > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't2.c:7:3,' %t && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/foo.h:4:9 -print-refs > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't1.c:8:3,' %t && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:3:22 -print-refs > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't1.c:6:17,' %t && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:4:11 -print-refs > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't1.c:6:5,' %t && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:5:30 -print-refs > %t && +// RUN: cat %t | count 3 && +// RUN: grep 't1.c:5:27,' %t && +// RUN: grep 't1.c:5:44,' %t && +// RUN: grep 't1.c:6:26,' %t && // field test + // FIXME: References point at the start of MemberExpr, make them point at the field instead. -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:12:7 -print-refs | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:12:7 -print-refs | grep 't1.c:21:3,' && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:16:7 -print-refs | count 1 && -// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:16:7 -print-refs | grep 't1.c:22:3,' +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:12:7 -print-refs > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't1.c:21:3,' %t && + +// RUN: index-test %t1.ast %t2.ast -point-at %S/t1.c:16:7 -print-refs > %t && +// RUN: cat %t | count 1 && +// RUN: grep 't1.c:22:3,' %t diff --git a/test/Index/resolve-loc.c b/test/Index/resolve-loc.c index a27fca7a86..6da59f0342 100644 --- a/test/Index/resolve-loc.c +++ b/test/Index/resolve-loc.c @@ -24,11 +24,16 @@ struct S { // RUN: index-test %t.ast -point-at %s:7:23 | grep param2 && // RUN: index-test %t.ast -point-at %s:8:10 | grep local_var1 && // RUN: index-test %t.ast -point-at %s:9:15 | grep for_var && -// RUN: index-test %t.ast -point-at %s:9:43 | grep top_func_def && -// RUN: index-test %t.ast -point-at %s:9:43 | grep '++for_var' && + +// RUN: index-test %t.ast -point-at %s:9:43 > %t && +// RUN: grep top_func_def %s && +// RUN: grep '++for_var' %s && + // RUN: index-test %t.ast -point-at %s:10:9 | grep local_var2 && -// RUN: index-test %t.ast -point-at %s:10:30 | grep local_var2 && -// RUN: index-test %t.ast -point-at %s:10:30 | grep 'for_var + 1' && + +// RUN: index-test %t.ast -point-at %s:10:30 > %t && +// RUN: grep local_var2 %t && +// RUN: grep 'for_var + 1' %t && // fields test. // RUN: index-test %t.ast -point-at %s:15:10 | grep field_var -- 2.40.0