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

Alexey Samsonov samsonov at google.com
Thu Aug 29 08:48:25 PDT 2013


  Thanks! I've addressed these comments in r189588


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

================
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')
----------------
Alexander Potapenko wrote:
> You may want to suppress the stderr from nm.
Done

================
Comment at: lib/sanitizer_common/scripts/gen_dynamic_list.py:34
@@ +33,3 @@
+
+result = []
+
----------------
Alexander Potapenko wrote:
> It's better to define a main(argv) function invoked as follows:
> 
>   if __name__ == "__main__":
>     main(sys.argv)
Done

================
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',
----------------
Alexander Potapenko wrote:
> 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.
Done

================
Comment at: lib/sanitizer_common/scripts/gen_dynamic_list.py:53
@@ +52,3 @@
+  # Export interceptors.
+  match = re.match('__interceptor_(.*)', func)
+  if match:
----------------
Alexander Potapenko wrote:
> Depending on the number of functions, using re.compile may speed up the things.
Python manual says that "The compiled versions of the most recent patterns passed to re.match(), re.search() or re.compile() are cached, so programs that use only a few regular expressions at a time needn’t worry about compiling regular expressions."


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



More information about the llvm-commits mailing list