MCPcopy Create free account
hub / github.com/SolaWing/xcode-build-server / parse_c

Method parse_c

xclog_parser.py:187–223  ·  view source on GitHub ↗
(self, line)

Source from the content-addressed store, hash-verified

185 return module
186
187 def parse_c(self, line):
188 if not line.startswith("CompileC "):
189 return
190
191 li = read_until_empty_line(self._input)
192 if not li:
193 return
194
195 found_command = False
196 command: str = None # type: ignore
197 for command in li:
198 if re.match(self.clang_exec, command):
199 found_command = True
200 break
201
202 if not self.skip_validate_bin and not found_command:
203 echo("Error: ========== Can't find clang\n" + "\n".join(li))
204 return
205
206 info = cmd_split(line)
207
208 module = {}
209 directory = next((cmd_split(i)[1] for i in li if i.startswith("cd ")), None)
210 if directory:
211 module["directory"] = directory
212 pch = self._pch_info.get(" ".join(info[3:]))
213 if pch is not None:
214 # when GCC_PRECOMPILE_PREFIX_HEADER=YES, pch is processed and command specify a invalid pch path, replace it to the local pch path
215 # same behavior like xcpretty
216 command = pch_capture.sub(f"-include {shlex.quote(pch)}", command)
217
218 module["command"] = command
219 module["file"] = info[2]
220 module["output"] = info[1]
221
222 echo(f"CompileC {info[2]}")
223 return module
224
225 def parse_pch(self, line):
226 """

Callers

nothing calls this directly

Calls 4

read_until_empty_lineFunction · 0.85
echoFunction · 0.85
getMethod · 0.80
cmd_splitFunction · 0.70

Tested by

no test coverage detected