[PATCH] Properly generate lists of exported symbols for sanitizer runtimes

Alexander Potapenko glider at google.com
Wed Aug 28 06:57:08 PDT 2013


  Several drive-by comments. Dunno if Google Python Style Guide is applicable here, so feel free to ignore them.


================
Comment at: lib/sanitizer_common/scripts/gen_dynamic_list.py:17
@@ +16,3 @@
+#===------------------------------------------------------------------------===#
+import re
+import os
----------------
Per Google Python Style Guide, the imports should be sorted alphabetically.

================
Comment at: lib/sanitizer_common/scripts/gen_dynamic_list.py:34
@@ +33,3 @@
+
+result = []
+
----------------
It's better to define a main(argv) function invoked as follows:

  if __name__ == "__main__":
    main(sys.argv)

================
Comment at: lib/sanitizer_common/scripts/gen_dynamic_list.py:39
@@ +38,3 @@
+function_set = set(all_functions)
+new_delete = set(['_ZdaPv', '_ZdaPvRKSt9nothrow_t',
+                  '_ZdlPv', '_ZdlPvRKSt9nothrow_t',
----------------
It's better to make new_delete and versioned_functions global constants at the top of the script, so that one can find and change them easily.

================
Comment at: lib/sanitizer_common/scripts/gen_dynamic_list.py:53
@@ +52,3 @@
+  # Export interceptors.
+  match = re.match('__interceptor_(.*)', func)
+  if match:
----------------
Depending on the number of functions, using re.compile may speed up the things.

================
Comment at: lib/sanitizer_common/scripts/gen_dynamic_list.py:24
@@ +23,3 @@
+  functions = []
+  nm_proc = subprocess.Popen(['nm', library], stdout=subprocess.PIPE)
+  nm_out = nm_proc.communicate()[0].split('\n')
----------------
You may want to suppress the stderr from nm.


http://llvm-reviews.chandlerc.com/D1516



More information about the llvm-commits mailing list