aboutsummaryrefslogtreecommitdiff
path: root/utils/ClangDataFormat.py
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-11-14 23:52:11 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-11-14 23:52:11 +0000
commit29a67e8f3adbd433acf271f7be699c50ceb7bdef (patch)
treeec42cf7b1aff713d7be794bd91ea99bbf0f6eb95 /utils/ClangDataFormat.py
parent06cffc0511ba76d979fad9ef6944e685936b62f0 (diff)
[utils/ClangDataFormat.py] In the summary of SourceLocation, include whether it is
local or loaded. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168002 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/ClangDataFormat.py')
-rw-r--r--utils/ClangDataFormat.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/utils/ClangDataFormat.py b/utils/ClangDataFormat.py
index ec44d2a31b..817c0b6056 100644
--- a/utils/ClangDataFormat.py
+++ b/utils/ClangDataFormat.py
@@ -16,7 +16,7 @@ After that, instead of getting this:
you'll get:
(lldb) p Tok.Loc
-(clang::SourceLocation) $4 = "/usr/include/i386/_types.h:37:1" (offset: 123582, file)
+(clang::SourceLocation) $4 = "/usr/include/i386/_types.h:37:1" (offset: 123582, file, local)
"""
import lldb
@@ -37,6 +37,9 @@ class SourceLocation(object):
def isMacro(self):
return getValueFromExpression(self.srcloc, ".isMacroID()").GetValueAsUnsigned()
+ def isLocal(self, srcmgr_path):
+ return lldb.frame.EvaluateExpression("(%s).isLocalSourceLocation(%s)" % (srcmgr_path, getExpressionPath(self.srcloc))).GetValueAsUnsigned()
+
def getPrint(self, srcmgr_path):
print_str = getValueFromExpression(self.srcloc, ".printToString(%s)" % srcmgr_path)
return print_str.GetSummary()
@@ -45,7 +48,7 @@ class SourceLocation(object):
desc = "(offset: %d, %s)" % (self.offset(), "macro" if self.isMacro() else "file")
srcmgr_path = findObjectExpressionPath("clang::SourceManager", lldb.frame)
if srcmgr_path:
- desc = self.getPrint(srcmgr_path) + " " + desc
+ 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 desc
# Key is a (function address, type name) tuple, value is the expression path for