Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fms-extensions %s -emit-llvm -o - | FileCheck %s |
Anders Carlsson | 3a082d8 | 2009-09-08 18:24:21 +0000 | [diff] [blame] | 3 | |
Rafael Espindola | 1257bc6 | 2011-01-10 22:34:03 +0000 | [diff] [blame] | 4 | // CHECK: @__func__.plainFunction = private unnamed_addr constant [14 x i8] c"plainFunction\00" |
| 5 | // CHECK: @__PRETTY_FUNCTION__.plainFunction = private unnamed_addr constant [21 x i8] c"void plainFunction()\00" |
| 6 | // CHECK: @__func__.externFunction = private unnamed_addr constant [15 x i8] c"externFunction\00" |
| 7 | // CHECK: @__PRETTY_FUNCTION__.externFunction = private unnamed_addr constant [22 x i8] c"void externFunction()\00" |
| 8 | // CHECK: @__func__.privateExternFunction = private unnamed_addr constant [22 x i8] c"privateExternFunction\00" |
| 9 | // 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] | 10 | // CHECK: @__func__.__captured_stmt = private unnamed_addr constant [25 x i8] c"functionWithCapturedStmt\00" |
| 11 | // 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] | 12 | // CHECK: @__func__.staticFunction = private unnamed_addr constant [15 x i8] c"staticFunction\00" |
| 13 | // 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] | 14 | |
Daniel Dunbar | 23afaad | 2009-11-17 08:57:36 +0000 | [diff] [blame] | 15 | int printf(const char *, ...); |
Anders Carlsson | 3a082d8 | 2009-09-08 18:24:21 +0000 | [diff] [blame] | 16 | |
| 17 | void plainFunction() { |
| 18 | printf("__func__ %s\n", __func__); |
| 19 | printf("__FUNCTION__ %s\n", __FUNCTION__); |
| 20 | printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); |
| 21 | } |
| 22 | |
| 23 | extern void externFunction() { |
| 24 | printf("__func__ %s\n", __func__); |
| 25 | printf("__FUNCTION__ %s\n", __FUNCTION__); |
| 26 | printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); |
| 27 | } |
| 28 | |
| 29 | __private_extern__ void privateExternFunction() { |
| 30 | printf("__func__ %s\n", __func__); |
| 31 | printf("__FUNCTION__ %s\n", __FUNCTION__); |
| 32 | printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); |
| 33 | } |
| 34 | |
Wei Pan | 15b2674 | 2013-08-26 14:27:34 +0000 | [diff] [blame] | 35 | void functionWithCapturedStmt() { |
| 36 | #pragma clang __debug captured |
| 37 | { |
| 38 | printf("__func__ %s\n", __func__); |
| 39 | printf("__FUNCTION__ %s\n", __FUNCTION__); |
| 40 | printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); |
| 41 | } |
| 42 | } |
| 43 | |
Anders Carlsson | 3a082d8 | 2009-09-08 18:24:21 +0000 | [diff] [blame] | 44 | static void staticFunction() { |
| 45 | printf("__func__ %s\n", __func__); |
| 46 | printf("__FUNCTION__ %s\n", __FUNCTION__); |
| 47 | printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); |
| 48 | } |
| 49 | |
| 50 | int main() { |
| 51 | plainFunction(); |
| 52 | externFunction(); |
| 53 | privateExternFunction(); |
Wei Pan | 15b2674 | 2013-08-26 14:27:34 +0000 | [diff] [blame] | 54 | functionWithCapturedStmt(); |
Anders Carlsson | 3a082d8 | 2009-09-08 18:24:21 +0000 | [diff] [blame] | 55 | staticFunction(); |
| 56 | |
| 57 | return 0; |
| 58 | } |