Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions llvm/utils/LLVMVisualizers/llvm.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,6 @@ For later versions of Visual Studio, no setup is required.
<DisplayString>{Data}</DisplayString>
</Type>

<Type Name="llvm::Optional&lt;*&gt;">
<DisplayString Condition="!Storage.hasVal">None</DisplayString>
<DisplayString Condition="Storage.hasVal">{Storage.value}</DisplayString>
<Expand>
<Item Name="[underlying]" Condition="Storage.hasVal">Storage.value</Item>
</Expand>
</Type>

<Type Name="llvm::Expected&lt;*&gt;">
<DisplayString Condition="HasError">Error</DisplayString>
<DisplayString Condition="!HasError">{*((storage_type *)TStorage.buffer)}</DisplayString>
Expand Down
22 changes: 0 additions & 22 deletions llvm/utils/gdb-scripts/prettyprinters.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,27 +142,6 @@ def to_string(self):
return "llvm::Expected{}".format(" is error" if self.val["HasError"] else "")


class OptionalPrinter(Iterator):
"""Print an llvm::Optional object."""

def __init__(self, val):
self.val = val

def __next__(self):
val = self.val
if val is None:
raise StopIteration
self.val = None
if not val["Storage"]["hasVal"]:
raise StopIteration
return ("value", val["Storage"]["val"])

def to_string(self):
return "llvm::Optional{}".format(
"" if self.val["Storage"]["hasVal"] else " is not initialized"
)


class DenseMapPrinter:
"Print a DenseMap"

Expand Down Expand Up @@ -543,7 +522,6 @@ def children(self):
)
pp.add_printer("llvm::ArrayRef", "^llvm::(Mutable)?ArrayRef<.*>$", ArrayRefPrinter)
pp.add_printer("llvm::Expected", "^llvm::Expected<.*>$", ExpectedPrinter)
pp.add_printer("llvm::Optional", "^llvm::Optional<.*>$", OptionalPrinter)
pp.add_printer("llvm::DenseMap", "^llvm::DenseMap<.*>$", DenseMapPrinter)
pp.add_printer("llvm::StringMap", "^llvm::StringMap<.*>$", StringMapPrinter)
pp.add_printer("llvm::Twine", "^llvm::Twine$", TwinePrinter)
Expand Down
57 changes: 0 additions & 57 deletions llvm/utils/lldbDataFormatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@ def __lldb_init_module(debugger, internal_dict):
'-e -s "size=${svar%#}" '
'-x "^llvm::ArrayRef<.+>$"'
)
debugger.HandleCommand(
"type synthetic add -w llvm "
f"-l {__name__}.OptionalSynthProvider "
'-x "^llvm::Optional<.+>$"'
)
debugger.HandleCommand(
"type summary add -w llvm "
f"-e -F {__name__}.OptionalSummaryProvider "
'-x "^llvm::Optional<.+>$"'
)
debugger.HandleCommand(
"type summary add -w llvm "
f"-F {__name__}.SmallStringSummaryProvider "
Expand Down Expand Up @@ -177,53 +167,6 @@ def update(self):
assert self.type_size != 0


def GetOptionalValue(valobj):
storage = valobj.GetChildMemberWithName("Storage")
if not storage:
storage = valobj

failure = 2
hasVal = storage.GetChildMemberWithName("hasVal").GetValueAsUnsigned(failure)
if hasVal == failure:
return "<could not read llvm::Optional>"

if hasVal == 0:
return None

underlying_type = storage.GetType().GetTemplateArgumentType(0)
storage = storage.GetChildMemberWithName("value")
return storage.Cast(underlying_type)


def OptionalSummaryProvider(valobj, internal_dict):
val = GetOptionalValue(valobj)
if val is None:
return "None"
if val.summary:
return val.summary
return ""


class OptionalSynthProvider:
"""Provides deref support to llvm::Optional<T>"""

def __init__(self, valobj, internal_dict):
self.valobj = valobj

def num_children(self):
return self.valobj.num_children

def get_child_index(self, name):
if name == "$$dereference$$":
return self.valobj.num_children
return self.valobj.GetIndexOfChildWithName(name)

def get_child_at_index(self, index):
if index < self.valobj.num_children:
return self.valobj.GetChildAtIndex(index)
return GetOptionalValue(self.valobj) or lldb.SBValue()


def SmallStringSummaryProvider(valobj, internal_dict):
# The underlying SmallVector base class is the first child.
vector = valobj.GetChildAtIndex(0)
Expand Down