Mercurial > hg > CbC > CbC_llvm
diff utils/lldbDataFormatters.py @ 95:afa8332a0e37 LLVM3.8
LLVM 3.8
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 13 Oct 2015 17:48:58 +0900 |
parents | 60c9769439b8 |
children | c2174574ed3a |
line wrap: on
line diff
--- a/utils/lldbDataFormatters.py Wed Feb 18 14:56:07 2015 +0900 +++ b/utils/lldbDataFormatters.py Tue Oct 13 17:48:58 2015 +0900 @@ -15,6 +15,9 @@ debugger.HandleCommand('type synthetic add -w llvm ' '-l lldbDataFormatters.ArrayRefSynthProvider ' '-x "^llvm::ArrayRef<.+>$"') + debugger.HandleCommand('type summary add -w llvm ' + '-F lldbDataFormatters.OptionalSummaryProvider ' + '-x "^llvm::Optional<.+>$"') # Pretty printer for llvm::SmallVector/llvm::SmallVectorImpl class SmallVectorSynthProvider: @@ -86,3 +89,10 @@ self.data_type = self.data.GetType().GetPointeeType() self.type_size = self.data_type.GetByteSize() assert self.type_size != 0 + +def OptionalSummaryProvider(valobj, internal_dict): + if not valobj.GetChildMemberWithName('hasVal').GetValueAsUnsigned(0): + return 'None' + underlying_type = valobj.GetType().GetTemplateArgumentType(0) + storage = valobj.GetChildMemberWithName('storage') + return str(storage.Cast(underlying_type))