predefined-expr.c revision 23afaad895486d4a9ea672f497b63ebc4c588955
1// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s 2 3// CHECK: @__func__.plainFunction = private constant [14 x i8] c"plainFunction\00" 4// CHECK: @__PRETTY_FUNCTION__.plainFunction = private constant [21 x i8] c"void plainFunction()\00" 5// CHECK: @__func__.externFunction = private constant [15 x i8] c"externFunction\00" 6// CHECK: @__PRETTY_FUNCTION__.externFunction = private constant [22 x i8] c"void externFunction()\00" 7// CHECK: @__func__.privateExternFunction = private constant [22 x i8] c"privateExternFunction\00" 8// CHECK: @__PRETTY_FUNCTION__.privateExternFunction = private constant [29 x i8] c"void privateExternFunction()\00" 9// CHECK: @__func__.staticFunction = private constant [15 x i8] c"staticFunction\00" 10// CHECK: @__PRETTY_FUNCTION__.staticFunction = private constant [22 x i8] c"void staticFunction()\00" 11 12int printf(const char *, ...); 13 14void plainFunction() { 15 printf("__func__ %s\n", __func__); 16 printf("__FUNCTION__ %s\n", __FUNCTION__); 17 printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); 18} 19 20extern void externFunction() { 21 printf("__func__ %s\n", __func__); 22 printf("__FUNCTION__ %s\n", __FUNCTION__); 23 printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); 24} 25 26__private_extern__ void privateExternFunction() { 27 printf("__func__ %s\n", __func__); 28 printf("__FUNCTION__ %s\n", __FUNCTION__); 29 printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); 30} 31 32static void staticFunction() { 33 printf("__func__ %s\n", __func__); 34 printf("__FUNCTION__ %s\n", __FUNCTION__); 35 printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); 36} 37 38int main() { 39 plainFunction(); 40 externFunction(); 41 privateExternFunction(); 42 staticFunction(); 43 44 return 0; 45} 46