This revision was automatically updated to reflect the committed changes.
Closed by commit rGb59b3640bcbd: Debug Info: Mark os_log helper functions as 
artificial (authored by aprantl).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80463/new/

https://reviews.llvm.org/D80463

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/debug-info-oslog.c


Index: clang/test/CodeGen/debug-info-oslog.c
===================================================================
--- /dev/null
+++ clang/test/CodeGen/debug-info-oslog.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple x86_64-darwin-apple -debug-info-kind=limited \
+// RUN:   %s -emit-llvm -o -  | FileCheck %s
+void test_builtin_os_log(void *buf, int i, const char *data) {
+  __builtin_os_log_format(buf, "%d", i);
+}
+
+// CHECK: define linkonce_odr {{.*}}@__os_log_helper_1_0_1_4_0(
+// CHECK-SAME:   !dbg ![[OS_LOG_HELPER:[0-9]+]]
+
+// This helper is going to be uniqued, so it should not have a line
+// number between file and type.
+
+// CHECK: distinct !DISubprogram(name: "__os_log_helper_1_0_1_4_0",
+// CHECK-SAME:                   file: !{{[0-9+]}}, type
+// CHECK-SAME:                   flags: DIFlagArtificial
Index: clang/lib/CodeGen/CGBuiltin.cpp
===================================================================
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -1271,6 +1271,8 @@
   FunctionDecl *FD = FunctionDecl::Create(
       Ctx, Ctx.getTranslationUnitDecl(), SourceLocation(), SourceLocation(), 
II,
       FuncionTy, nullptr, SC_PrivateExtern, false, false);
+  // Avoid generating debug location info for the function.
+  FD->setImplicit();
 
   StartFunction(FD, ReturnTy, Fn, FI, Args);
 


Index: clang/test/CodeGen/debug-info-oslog.c
===================================================================
--- /dev/null
+++ clang/test/CodeGen/debug-info-oslog.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple x86_64-darwin-apple -debug-info-kind=limited \
+// RUN:   %s -emit-llvm -o -  | FileCheck %s
+void test_builtin_os_log(void *buf, int i, const char *data) {
+  __builtin_os_log_format(buf, "%d", i);
+}
+
+// CHECK: define linkonce_odr {{.*}}@__os_log_helper_1_0_1_4_0(
+// CHECK-SAME:   !dbg ![[OS_LOG_HELPER:[0-9]+]]
+
+// This helper is going to be uniqued, so it should not have a line
+// number between file and type.
+
+// CHECK: distinct !DISubprogram(name: "__os_log_helper_1_0_1_4_0",
+// CHECK-SAME:                   file: !{{[0-9+]}}, type
+// CHECK-SAME:                   flags: DIFlagArtificial
Index: clang/lib/CodeGen/CGBuiltin.cpp
===================================================================
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -1271,6 +1271,8 @@
   FunctionDecl *FD = FunctionDecl::Create(
       Ctx, Ctx.getTranslationUnitDecl(), SourceLocation(), SourceLocation(), II,
       FuncionTy, nullptr, SC_PrivateExtern, false, false);
+  // Avoid generating debug location info for the function.
+  FD->setImplicit();
 
   StartFunction(FD, ReturnTy, Fn, FI, Args);
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to