28 lines · c
1// RUN: %clang_cc1 -std=c89 -emit-llvm %s -o - | FileCheck %s --check-prefix=C892// RUN: %clang_cc1 -std=c99 -emit-llvm %s -o - | FileCheck %s --check-prefix=C993 4void f(void* arg);5void g(void) {6 __attribute__((cleanup(f))) void *g;7}8 9void cleaner(int *p);10 11// C89-LABEL: define{{.*}} void @test_nested_for_loop_cleanup()12// C99-LABEL: define{{.*}} void @test_nested_for_loop_cleanup()13void test_nested_for_loop_cleanup(void) {14 for (int i = 10; 0;) {15 for (__attribute__((cleanup(cleaner))) int j = 20; 0;)16 ;17 i = 5; // Some operation after inner loop18 }19}20 21// C89: for.end:22// C89-NEXT: store i32 5, ptr %i, align 423// C89-NEXT: call void @cleaner(ptr noundef %j)24 25// C99: for.cond.cleanup:26// C99-NEXT: call void @cleaner(ptr noundef %j)27// C99-NEXT: br label %for.end28