aboutsummaryrefslogtreecommitdiff
path: root/utils/ClangDataFormat.py
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-11-15 20:59:00 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-11-15 20:59:00 +0000
commit596be9372b79842b74c0654ab3dab33200812e8a (patch)
tree6220248ff8e51213ff736e161cf1e49e186aa701 /utils/ClangDataFormat.py
parent5564e6c45401c37adb9444b6bf0ef8ce70b1fce8 (diff)
[utils/ClangDataFormat.py] For invalid source locations just return
"<invalid loc>" for summary. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168087 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/ClangDataFormat.py')
-rw-r--r--utils/ClangDataFormat.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/utils/ClangDataFormat.py b/utils/ClangDataFormat.py
index bde38111d2..23aaba2211 100644
--- a/utils/ClangDataFormat.py
+++ b/utils/ClangDataFormat.py
@@ -34,10 +34,14 @@ def StringRef_summary(strref, internal_dict):
class SourceLocation(object):
def __init__(self, srcloc):
self.srcloc = srcloc
+ self.ID = srcloc.GetChildAtIndex(0).GetValueAsUnsigned()
def offset(self):
return getValueFromExpression(self.srcloc, ".getOffset()").GetValueAsUnsigned()
+ def isInvalid(self):
+ return self.ID == 0
+
def isMacro(self):
return getValueFromExpression(self.srcloc, ".isMacroID()").GetValueAsUnsigned()
@@ -49,6 +53,8 @@ class SourceLocation(object):
return print_str.GetSummary()
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: