[clang] 0300e16 - libclang: Fixes for the python script that generates the export list

Tom Stellard via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 26 18:40:25 PDT 2021


Author: Tom Stellard
Date: 2021-07-26T18:39:53-07:00
New Revision: 0300e16eb0a8e7bd980b6b14b6a3bae38786651d

URL: https://github.com/llvm/llvm-project/commit/0300e16eb0a8e7bd980b6b14b6a3bae38786651d
DIFF: https://github.com/llvm/llvm-project/commit/0300e16eb0a8e7bd980b6b14b6a3bae38786651d.diff

LOG: libclang: Fixes for the python script that generates the export list

This script was added in 0cf37a3b0617457daaed3224373ffa07724f8482.

Added: 
    

Modified: 
    clang/tools/libclang/CMakeLists.txt
    clang/tools/libclang/linker-script-to-export-list.py

Removed: 
    


################################################################################
diff  --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
index f5297ba53966..65863d7508a8 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -64,7 +64,7 @@ endif ()
 option(LIBCLANG_BUILD_STATIC
   "Build libclang as a static library (in addition to a shared one)" OFF)
 
-set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libclang.exports)
+set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_BINARY_DIR}/libclang-generic.exports)
 set(LIBCLANG_VERSION_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libclang.map)
 
 if(MSVC)

diff  --git a/clang/tools/libclang/linker-script-to-export-list.py b/clang/tools/libclang/linker-script-to-export-list.py
index 4b57be03c6c7..37fb172b9a0a 100644
--- a/clang/tools/libclang/linker-script-to-export-list.py
+++ b/clang/tools/libclang/linker-script-to-export-list.py
@@ -3,9 +3,9 @@
 import sys
 
 input_file = open(sys.argv[1])
-output_file = open(sys.argv[2])
+output_file = open(sys.argv[2], 'w')
 
 for line in input_file:
-    m = re.search('clang_[^;]+', line)
+    m = re.search('^\s+(clang_[^;]+)', line)
     if m:
-        output_file.write(m.group(0))
+        output_file.write(m.group(1) + "\n")


        


More information about the cfe-commits mailing list