-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DEBUG-INFO] Change how we handle auto return types for lambda operat…
…or() to be consistent with gcc D70524 added support for auto return types for C++ member functions. I was implementing support on the LLDB side for looking up the deduced type. I ran into trouble with some cases with respect to lambdas. I looked into how gcc was handling these cases and it appears gcc emits the deduced return type for lambdas. So I am changing out behavior to match that. Differential Revision: https://reviews.llvm.org/D123319
- Loading branch information
Showing
2 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s | ||
|
||
// We emit "auto" for deduced return types for member functions but we should | ||
// not emitting "auto" for deduced return types for lambdas call function which | ||
// will be implmented as operator() in a class type. This test will verify that | ||
// behavior. | ||
|
||
__attribute__((used)) int g() { | ||
auto f = []() { return 10; }; | ||
return f(); | ||
} | ||
|
||
// g() is not a member function so we should not emit "auto" for the deduced | ||
// return type. | ||
// | ||
// CHECK: !DISubprogram(name: "g",{{.*}}, type: ![[FUN_TYPE:[0-9]+]],{{.*}} | ||
// CHECK: ![[FUN_TYPE]] = !DISubroutineType(types: ![[TYPE_NODE:[0-9]+]]) | ||
// CHECK: ![[TYPE_NODE]] = !{![[INT_TYPE:[0-9]+]]} | ||
// CHECK: ![[INT_TYPE]] = !DIBasicType(name: "int", {{.*}}) | ||
|
||
// operator() of the local lambda should have the same return type as g() | ||
// | ||
// CHECK: distinct !DISubprogram(name: "operator()",{{.*}}, type: ![[FUN_TYPE_LAMBDA:[0-9]+]],{{.*}} | ||
// CHECK: ![[FUN_TYPE_LAMBDA]] = !DISubroutineType(types: ![[TYPE_NODE_LAMBDA:[0-9]+]]) | ||
// CHECK: ![[TYPE_NODE_LAMBDA]] = !{![[INT_TYPE:[0-9]+]], {{.*}} |