[Lldb-commits] [PATCH] D96366: Remove uneeded CopyType from BlockPointerSyntheticFrontEnd
Shafik Yaghmour via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 9 16:11:46 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4f14c17df709: [LLDB] Remove uneeded CopyType from BlockPointerSyntheticFrontEnd (authored by shafik).
Herald added a project: LLDB.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96366/new/
https://reviews.llvm.org/D96366
Files:
lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
lldb/test/API/lang/c/blocks/TestBlocks.py
lldb/test/API/lang/c/blocks/main.c
Index: lldb/test/API/lang/c/blocks/main.c
===================================================================
--- lldb/test/API/lang/c/blocks/main.c
+++ lldb/test/API/lang/c/blocks/main.c
@@ -1,5 +1,17 @@
#include <stdio.h>
+struct CG {int x; int y;};
+
+int g(int (^callback)(struct CG)) {
+ struct CG cg = {.x=1,.y=2};
+
+ int z = callback(cg); // Set breakpoint 2 here.
+
+ return z;
+}
+
+int h(struct CG cg){return 42;}
+
int main()
{
int c = 1;
@@ -17,5 +29,12 @@
printf("%d\n", add(3, 4));
printf("%d\n", neg(-5)); // Set breakpoint 1 here.
+ int (^add_struct)(struct CG) = ^int(struct CG cg)
+ {
+ return cg.x + cg.y;
+ };
+
+ g(add_struct);
+
return 0;
}
Index: lldb/test/API/lang/c/blocks/TestBlocks.py
===================================================================
--- lldb/test/API/lang/c/blocks/TestBlocks.py
+++ lldb/test/API/lang/c/blocks/TestBlocks.py
@@ -20,6 +20,7 @@
# Find the line numbers to break at.
self.lines.append(line_number('main.c', '// Set breakpoint 0 here.'))
self.lines.append(line_number('main.c', '// Set breakpoint 1 here.'))
+ self.lines.append(line_number('main.c', '// Set breakpoint 2 here.'))
def launch_common(self):
self.build()
@@ -51,6 +52,10 @@
self.expect("expression (int)neg (-12)", VARIABLES_DISPLAYED_CORRECTLY,
substrs=["= 12"])
+ self.wait_for_breakpoint()
+
+ self.expect_expr("h(cg)", result_type="int", result_value="42")
+
@skipUnlessDarwin
def test_define(self):
self.launch_common()
Index: lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
===================================================================
--- lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
@@ -74,14 +74,12 @@
const CompilerType reserved_type =
clang_ast_context->GetBasicType(lldb::eBasicTypeInt);
const char *const FuncPtr_name("__FuncPtr");
- const CompilerType FuncPtr_type =
- clang_ast_importer->CopyType(*clang_ast_context, function_pointer_type);
m_block_struct_type = clang_ast_context->CreateStructForIdentifier(
ConstString(), {{isa_name, isa_type},
{flags_name, flags_type},
{reserved_name, reserved_type},
- {FuncPtr_name, FuncPtr_type}});
+ {FuncPtr_name, function_pointer_type}});
}
~BlockPointerSyntheticFrontEnd() override = default;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96366.322531.patch
Type: text/x-patch
Size: 2577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210210/d48ed12c/attachment.bin>
More information about the lldb-commits
mailing list