[libcxx-commits] [PATCH] D126303: [libc++] Use Python subprocess instead of libc++'s own utilities
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue May 24 08:15:55 PDT 2022
ldionne created this revision.
Herald added a subscriber: arichardson.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Once we move off entirely from the legacy testing framework, this will
allow removing a bunch of code.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D126303
Files:
libcxx/utils/libcxx/sym_check/extract.py
libcxx/utils/libcxx/sym_check/util.py
Index: libcxx/utils/libcxx/sym_check/util.py
===================================================================
--- libcxx/utils/libcxx/sym_check/util.py
+++ libcxx/utils/libcxx/sym_check/util.py
@@ -6,12 +6,12 @@
#
#===----------------------------------------------------------------------===##
+from pprint import pformat
import ast
import distutils.spawn
-import sys
import re
-import libcxx.util
-from pprint import pformat
+import subprocess
+import sys
def read_syms_from_list(slist):
@@ -66,11 +66,10 @@
def demangle_symbol(symbol):
if _cppfilt_exe is None:
return symbol
- out, _, exit_code = libcxx.util.executeCommandVerbose(
- [_cppfilt_exe], input=symbol)
- if exit_code != 0:
+ result = subprocess.run([_cppfilt_exe], input=symbol)
+ if result.returncode != 0:
return symbol
- return out
+ return result.stdout
def is_elf(filename):
Index: libcxx/utils/libcxx/sym_check/extract.py
===================================================================
--- libcxx/utils/libcxx/sym_check/extract.py
+++ libcxx/utils/libcxx/sym_check/extract.py
@@ -11,10 +11,10 @@
"""
import distutils.spawn
import os.path
-import sys
import re
+import subprocess
+import sys
-import libcxx.util
from libcxx.sym_check import util
extract_ignore_names = ['_init', '_fini']
@@ -51,9 +51,7 @@
parsed symbols.
"""
cmd = [self.nm_exe] + self.flags + [lib]
- out, _, exit_code = libcxx.util.executeCommandVerbose(cmd)
- if exit_code != 0:
- raise RuntimeError('Failed to run %s on %s' % (self.nm_exe, lib))
+ out = subprocess.check_output(cmd).decode()
fmt_syms = (self._extract_sym(l)
for l in out.splitlines() if l.strip())
# Cast symbol to string.
@@ -139,9 +137,7 @@
parsed symbols.
"""
cmd = [self.tool] + self.flags + [lib]
- out, _, exit_code = libcxx.util.executeCommandVerbose(cmd)
- if exit_code != 0:
- raise RuntimeError('Failed to run %s on %s' % (self.nm_exe, lib))
+ out = subprocess.check_output(cmd).decode()
dyn_syms = self.get_dynsym_table(out)
return self.process_syms(dyn_syms)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126303.431681.patch
Type: text/x-patch
Size: 2238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220524/c8882d5c/attachment.bin>
More information about the libcxx-commits
mailing list