[PATCH] D57783: [analyzer] [testing] Inside CmpRuns.py output also print the filename of the first item in the path

George Karpenkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 5 14:26:52 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL353228: [analyzer] [testing] Inside CmpRuns.py output also print the filename of theā€¦ (authored by george.karpenkov, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D57783?vs=185394&id=185408#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57783/new/

https://reviews.llvm.org/D57783

Files:
  cfe/trunk/utils/analyzer/CmpRuns.py


Index: cfe/trunk/utils/analyzer/CmpRuns.py
===================================================================
--- cfe/trunk/utils/analyzer/CmpRuns.py
+++ cfe/trunk/utils/analyzer/CmpRuns.py
@@ -73,6 +73,21 @@
             return fileName[len(root) + 1:]
         return fileName
 
+    def getRootFileName(self):
+        path = self._data['path']
+        if not path:
+            return self.getFileName()
+        p = path[0]
+        if 'location' in p:
+            fIdx = p['location']['file']
+        else: # control edge
+            fIdx = path[0]['edges'][0]['start'][0]['file']
+        out = self._report.files[fIdx]
+        root = self._report.run.root
+        if out.startswith(root):
+            return out[len(root):]
+        return out
+
     def getLine(self):
         return self._loc['line']
 
@@ -106,7 +121,13 @@
             funcnamePostfix = "#" + self._data['issue_context']
         else:
             funcnamePostfix = ""
-        return '%s%s:%d:%d, %s: %s' % (self.getFileName(),
+        rootFilename = self.getRootFileName()
+        fileName = self.getFileName()
+        if rootFilename != fileName:
+            filePrefix = "[%s] %s" % (rootFilename, fileName)
+        else:
+            filePrefix = rootFilename
+        return '%s%s:%d:%d, %s: %s' % (filePrefix,
                                        funcnamePostfix,
                                        self.getLine(),
                                        self.getColumn(), self.getCategory(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57783.185408.patch
Type: text/x-patch
Size: 1501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190205/f3c2af83/attachment.bin>


More information about the llvm-commits mailing list