From 35a42cd0fe1d1725dbff1d98fe60a93c6d54ff74 Mon Sep 17 00:00:00 2001 From: Georgiy Komarov Date: Sat, 9 Jan 2021 00:59:58 +0300 Subject: [PATCH] cppcheckdata: Make the source files for configuration public (#3030) Extend CppcheckData class API to make the list of source files public. This can be used by custom addons. --- addons/cppcheckdata.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/cppcheckdata.py b/addons/cppcheckdata.py index e54677fbe..2752a6d35 100755 --- a/addons/cppcheckdata.py +++ b/addons/cppcheckdata.py @@ -823,6 +823,7 @@ class CppcheckData: filename Path to Cppcheck dump file rawTokens List of rawToken elements suppressions List of Suppressions + files Source files for elements occurred in this configuration To iterate through all configurations use such code: @code @@ -860,8 +861,8 @@ class CppcheckData: self.rawTokens = [] self.platform = None self.suppressions = [] + self.files = [] - files = [] # source files for elements occurred in this configuration platform_done = False rawtokens_done = False suppressions_done = False @@ -878,10 +879,10 @@ class CppcheckData: elif node.tag == 'rawtokens' and event == 'end': for rawtokens_node in node: if rawtokens_node.tag == 'file': - files.append(rawtokens_node.get('name')) + self.files.append(rawtokens_node.get('name')) elif rawtokens_node.tag == 'tok': tok = Token(rawtokens_node) - tok.file = files[int(rawtokens_node.get('fileIndex'))] + tok.file = self.files[int(rawtokens_node.get('fileIndex'))] self.rawTokens.append(tok) rawtokens_done = True elif node.tag == 'suppressions' and event == 'end':