diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-11-16 00:25:26 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-11-16 00:25:26 +0000 |
commit | 71c81b63bcba10f5356c8836fe1828c08e025497 (patch) | |
tree | 61a6dd418ec5757998187e9256942e495a2b0496 /clang/utils/ClangDataFormat.py | |
parent | a342cb9613d33a50e25800d1d2414bec31249ab6 (diff) | |
download | bcm5719-llvm-71c81b63bcba10f5356c8836fe1828c08e025497.tar.gz bcm5719-llvm-71c81b63bcba10f5356c8836fe1828c08e025497.zip |
[ClangDataFormat.py] Add summary for QualType.
llvm-svn: 168117
Diffstat (limited to 'clang/utils/ClangDataFormat.py')
-rw-r--r-- | clang/utils/ClangDataFormat.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/clang/utils/ClangDataFormat.py b/clang/utils/ClangDataFormat.py index 23aaba22119..a80f0b579fb 100644 --- a/clang/utils/ClangDataFormat.py +++ b/clang/utils/ClangDataFormat.py @@ -23,11 +23,15 @@ import lldb 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 @@ class SourceLocation(object): 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): |