[cfe-commits] r168117 - /cfe/trunk/utils/ClangDataFormat.py

Matthieu Monrocq matthieu.monrocq at gmail.com
Fri Nov 16 10:05:20 PST 2012


On Fri, Nov 16, 2012 at 1:25 AM, Argyrios Kyrtzidis <akyrtzi at gmail.com>wrote:

> Author: akirtzidis
> Date: Thu Nov 15 18:25:26 2012
> New Revision: 168117
>
> URL: http://llvm.org/viewvc/llvm-project?rev=168117&view=rev
> Log:
> [ClangDataFormat.py] Add summary for QualType.
>
> Modified:
>     cfe/trunk/utils/ClangDataFormat.py
>
> Modified: cfe/trunk/utils/ClangDataFormat.py
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ClangDataFormat.py?rev=168117&r1=168116&r2=168117&view=diff
>
> ==============================================================================
> --- cfe/trunk/utils/ClangDataFormat.py (original)
> +++ cfe/trunk/utils/ClangDataFormat.py Thu Nov 15 18:25:26 2012
> @@ -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 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")
> +
>

Looks like you modified the pretty printer above QualType: was this
intended ?

-- Matthieu


> +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):
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121116/8e9e2653/attachment.html>


More information about the cfe-commits mailing list