Home | History | Annotate | Download | only in CodeGen
      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__.staticFunction = private unnamed_addr constant [15 x i8] c"staticFunction\00"
     10 // CHECK: @__PRETTY_FUNCTION__.staticFunction = private unnamed_addr constant [22 x i8] c"void staticFunction()\00"
     11 
     12 int printf(const char *, ...);
     13 
     14 void plainFunction() {
     15   printf("__func__ %s\n", __func__);
     16   printf("__FUNCTION__ %s\n", __FUNCTION__);
     17   printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
     18 }
     19 
     20 extern 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 
     32 static 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 
     38 int main() {
     39   plainFunction();
     40   externFunction();
     41   privateExternFunction();
     42   staticFunction();
     43 
     44   return 0;
     45 }
     46