Skip to content

Commit cbfe3bf

Browse files
authored
Merge pull request #685 from swiftwasm/swift/release/5.3
[pull] swiftwasm-release/5.3 from swift/release/5.3
2 parents 507d12f + 86cd2f5 commit cbfe3bf

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3797,12 +3797,12 @@ void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke,
37973797
if (Func->getSubprogram())
37983798
return;
37993799

3800-
// Do not emit a declaration subprogram for a builtin or if call site info
3801-
// isn't required. Also, elide declarations for functions with reserved names,
3802-
// as call site-related features aren't interesting in this case (& also, the
3803-
// compiler may emit calls to these functions without debug locations, which
3804-
// makes the verifier complain).
3805-
if (CalleeDecl->getBuiltinID() != 0 ||
3800+
// Do not emit a declaration subprogram for a builtin, a function with nodebug
3801+
// attribute, or if call site info isn't required. Also, elide declarations
3802+
// for functions with reserved names, as call site-related features aren't
3803+
// interesting in this case (& also, the compiler may emit calls to these
3804+
// functions without debug locations, which makes the verifier complain).
3805+
if (CalleeDecl->getBuiltinID() != 0 || CalleeDecl->hasAttr<NoDebugAttr>() ||
38063806
getCallSiteRelatedAttrs() == llvm::DINode::FlagZero)
38073807
return;
38083808
if (const auto *Id = CalleeDecl->getIdentifier())

clang/test/CodeGen/nodebug-attr.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -O3 \
2+
// RUN: -debug-info-kind=limited -o - -debugger-tuning=gdb -dwarf-version=4 \
3+
// RUN: | FileCheck %s
4+
5+
// Makes sure there is no !dbg between function attributes and '{'.
6+
// CHECK-LABEL: define void @foo{{.*}} #{{[0-9]+}} {
7+
// CHECK-NOT: ret {{.*}}!dbg
8+
__attribute__((nodebug)) void foo(int *a) {
9+
*a = 1;
10+
}
11+
12+
// CHECK-LABEL: define {{.*}}@bar{{.*}}!dbg
13+
void bar(int *a) {
14+
foo(a);
15+
}

0 commit comments

Comments
 (0)