Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[ClangDataFormat.py] Add summary for QualType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168117 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information...
commit fc0eb2a77b3b48f4f7f9338b158fa913cda0f774 1 parent 84fd6df
@akyrtzi akyrtzi authored
Showing with 19 additions and 2 deletions.
  1. +19 −2 utils/ClangDataFormat.py
View
21 utils/ClangDataFormat.py
@@ -23,11 +23,15 @@
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand("type summary add -F ClangDataFormat.SourceLocation_summary clang::SourceLocation")
+ debugger.HandleCommand("type summary add -F ClangDataFormat.QualType_summary clang::QualType")
debugger.HandleCommand("type summary add -F ClangDataFormat.StringRef_summary llvm::StringRef")
def SourceLocation_summary(srcloc, internal_dict):
return SourceLocation(srcloc).summary()
+def QualType_summary(qualty, internal_dict):
+ return QualType(qualty).summary()
+
def StringRef_summary(strref, internal_dict):
return StringRef(strref).summary()
@@ -55,10 +59,23 @@ def getPrint(self, srcmgr_path):
def summary(self):
if self.isInvalid():
return "<invalid loc>"
- desc = "(offset: %d, %s)" % (self.offset(), "macro" if self.isMacro() else "file")
srcmgr_path = findObjectExpressionPath("clang::SourceManager", lldb.frame)
if srcmgr_path:
- desc = "%s (offset: %d, %s, %s)" % (self.getPrint(srcmgr_path), self.offset(), "macro" if self.isMacro() else "file", "local" if self.isLocal(srcmgr_path) else "loaded")
+ return "%s (offset: %d, %s, %s)" % (self.getPrint(srcmgr_path), self.offset(), "macro" if self.isMacro() else "file", "local" if self.isLocal(srcmgr_path) else "loaded")
+ return "(offset: %d, %s)" % (self.offset(), "macro" if self.isMacro() else "file")
+
+class QualType(object):
+ def __init__(self, qualty):
+ self.qualty = qualty
+
+ def getAsString(self):
+ std_str = getValueFromExpression(self.qualty, ".getAsString()")
+ return std_str.GetSummary()
+
+ def summary(self):
+ desc = self.getAsString()
+ if desc == '"NULL TYPE"':
+ return "<NULL TYPE>"
return desc
class StringRef(object):
Please sign in to comment.
Something went wrong with that request. Please try again.