xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/predefined-expr.c (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1 // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
2 
3 // CHECK: @__func__.plainFunction = private unnamed_addr constant [14 x i8] c"plainFunction\00"
4 // CHECK: @__PRETTY_FUNCTION__.plainFunction = private unnamed_addr constant [21 x i8] c"void plainFunction()\00"
5 // CHECK: @__func__.externFunction = private unnamed_addr constant [15 x i8] c"externFunction\00"
6 // CHECK: @__PRETTY_FUNCTION__.externFunction = private unnamed_addr constant [22 x i8] c"void externFunction()\00"
7 // CHECK: @__func__.privateExternFunction = private unnamed_addr constant [22 x i8] c"privateExternFunction\00"
8 // CHECK: @__PRETTY_FUNCTION__.privateExternFunction = private unnamed_addr constant [29 x i8] c"void privateExternFunction()\00"
9 // CHECK: @__func__.__captured_stmt = private unnamed_addr constant [25 x i8] c"functionWithCapturedStmt\00"
10 // CHECK: @__PRETTY_FUNCTION__.__captured_stmt = private unnamed_addr constant [32 x i8] c"void functionWithCapturedStmt()\00"
11 // CHECK: @__func__.staticFunction = private unnamed_addr constant [15 x i8] c"staticFunction\00"
12 // CHECK: @__PRETTY_FUNCTION__.staticFunction = private unnamed_addr constant [22 x i8] c"void staticFunction()\00"
13 
14 int printf(const char *, ...);
15 
16 void plainFunction() {
17   printf("__func__ %s\n", __func__);
18   printf("__FUNCTION__ %s\n", __FUNCTION__);
19   printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
20 }
21 
22 extern void externFunction() {
23   printf("__func__ %s\n", __func__);
24   printf("__FUNCTION__ %s\n", __FUNCTION__);
25   printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
26 }
27 
28 __private_extern__ void privateExternFunction() {
29   printf("__func__ %s\n", __func__);
30   printf("__FUNCTION__ %s\n", __FUNCTION__);
31   printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
32 }
33 
34 void functionWithCapturedStmt() {
35   #pragma clang __debug captured
36   {
37     printf("__func__ %s\n", __func__);
38     printf("__FUNCTION__ %s\n", __FUNCTION__);
39     printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
40   }
41 }
42 
43 static void staticFunction() {
44   printf("__func__ %s\n", __func__);
45   printf("__FUNCTION__ %s\n", __FUNCTION__);
46   printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
47 }
48 
49 int main() {
50   plainFunction();
51   externFunction();
52   privateExternFunction();
53   functionWithCapturedStmt();
54   staticFunction();
55 
56   return 0;
57 }
58