[Lldb-commits] [PATCH] D80254: Prevent GetNumChildren from transitively walking pointer chains

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 20 02:40:07 PDT 2020


teemperor accepted this revision.
teemperor added subscribers: labath, clayborg.
teemperor added a comment.
This revision is now accepted and ready to land.

I think this looks good beside some minor nit-picks. Maybe @labath should take a second look too.



================
Comment at: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:5228
   case clang::Type::RValueReference: {
     const clang::ReferenceType *reference_type =
         llvm::cast<clang::ReferenceType>(qual_type.getTypePtr());
----------------
If you feel like refactoring this (by deleting code): You can also just delete all this and add the `RValueReference` and `LValueReference` to the `ObjCObjectPointer` above. `GetPointeeType` there is doing the same as the lines below and handles all ptrs/references. But that's optional.


================
Comment at: lldb/test/API/functionalities/pointer_num_children/TestPointerNumChildren.py:1
+"""
+"""
----------------
I guess this was just a placeholder?


================
Comment at: lldb/test/API/functionalities/pointer_num_children/TestPointerNumChildren.py:16
+        (_, _, thread, _) = lldbutil.run_to_source_breakpoint(self, "// break here", self.main_source_file)
+        frame = thread.GetSelectedFrame()
+
----------------
You can also do `self.frame()` and then you don't need to capture the thread above or declare a variable here. And I don't think you need to assign `self.main_source_file` (I believe this has no special meaning, other tests just did this because they liked to share the setup code in one setUp method).

```
lang=python
        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp"))

        result = self.frame().FindVariable("Ref")
```


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

https://reviews.llvm.org/D80254





More information about the lldb-commits mailing list