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

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Nov 15 12:59:00 PST 2012


Author: akirtzidis
Date: Thu Nov 15 14:59:00 2012
New Revision: 168087

URL: http://llvm.org/viewvc/llvm-project?rev=168087&view=rev
Log:
[utils/ClangDataFormat.py] For invalid source locations just return
"<invalid loc>" for summary.

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=168087&r1=168086&r2=168087&view=diff
==============================================================================
--- cfe/trunk/utils/ClangDataFormat.py (original)
+++ cfe/trunk/utils/ClangDataFormat.py Thu Nov 15 14:59:00 2012
@@ -34,10 +34,14 @@
 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 @@
 		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:





More information about the cfe-commits mailing list