Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s |
Anders Carlsson | 3a082d8 | 2009-09-08 18:24:21 +0000 | [diff] [blame] | 2 | |
Rafael Espindola | 1257bc6 | 2011-01-10 22:34:03 +0000 | [diff] [blame] | 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" |
Wei Pan | 15b2674 | 2013-08-26 14:27:34 +0000 | [diff] [blame] | 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" |
Rafael Espindola | 1257bc6 | 2011-01-10 22:34:03 +0000 | [diff] [blame] | 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" |
Anders Carlsson | 3a082d8 | 2009-09-08 18:24:21 +0000 | [diff] [blame] | 13 | |
Daniel Dunbar | 23afaad | 2009-11-17 08:57:36 +0000 | [diff] [blame] | 14 | int printf(const char *, ...); |
Anders Carlsson | 3a082d8 | 2009-09-08 18:24:21 +0000 | [diff] [blame] | 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 | |
Wei Pan | 15b2674 | 2013-08-26 14:27:34 +0000 | [diff] [blame] | 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 | |
Anders Carlsson | 3a082d8 | 2009-09-08 18:24:21 +0000 | [diff] [blame] | 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(); |
Wei Pan | 15b2674 | 2013-08-26 14:27:34 +0000 | [diff] [blame] | 53 | functionWithCapturedStmt(); |
Anders Carlsson | 3a082d8 | 2009-09-08 18:24:21 +0000 | [diff] [blame] | 54 | staticFunction(); |
| 55 | |
| 56 | return 0; |
| 57 | } |