[PATCH] D116113: Add LLDB synthetic child and summary scripts for llvm::SmallVector, llvm::Optional, llvm::ErrorOr and llvm::Expected.

walter erquinigo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 21 11:37:34 PST 2021


wallace added a comment.

thanks for doing this. Just a few minor comments and i think this is good to go



================
Comment at: clang/utils/ClangDataFormat.py:215-218
+        if self.hasVal:
+            result = self.value.GetIndexOfChildWithName(name)
+            return None if result == 4294967295 else result
+        return None
----------------
it's safe to return 0 here, as it'll be only invoked when there's a value, so there's a single child with index 0


================
Comment at: clang/utils/ClangDataFormat.py:221-223
+        if self.hasVal:
+            return self.value.GetChildAtIndex(index)
+        return None
----------------
wouldn' just

  return self.value

be enough?

index is always going to be 0 if called


================
Comment at: clang/utils/ClangDataFormat.py:279
+
+class Expected(object):
+    def __init__(self, valobj, internal_dict):
----------------
god bless you


================
Comment at: clang/utils/ClangDataFormat.py:331-335
+        # We compute the right value to use as the lldb.SBValue to use in
+        # self.value in the update() method so we can just use that object to
+        # get our asnwers
+        result = self.value.GetIndexOfChildWithName(name)
+        return None if result == 4294967295 else result
----------------
you can just return 0


================
Comment at: clang/utils/ClangDataFormat.py:409-410
+        # get our asnwers
+        result = self.value.GetIndexOfChildWithName(name)
+        return None if result == 4294967295 else result
+
----------------
ditto


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116113



More information about the cfe-commits mailing list