[Lldb-commits] [lldb] [lldb][headers] Create script to fix up versioning (PR #141116)
Hemang Gadhavi via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 4 03:59:11 PDT 2025
================
@@ -290,6 +290,45 @@ else()
endif()
endif()
+# Stage all headers in the include directory in the build dir.
+file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
+set(lldb_header_staging_dir ${CMAKE_BINARY_DIR}/include/lldb)
+file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
+file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
+list(REMOVE_ITEM root_public_headers ${root_private_headers})
+
+find_program(unifdef_EXECUTABLE unifdef)
+
+foreach(header
+ ${public_headers}
+ ${generated_public_headers}
+ ${root_public_headers})
+ get_filename_component(basename ${header} NAME)
+ set(staged_header ${lldb_header_staging_dir}/${basename})
+
+ if(unifdef_EXECUTABLE)
+ # unifdef returns 0 when the file is unchanged and 1 if something was changed.
+ # That means if we successfully remove SWIG code, the build system believes
+ # that the command has failed and stops. This is undesirable.
+ set(copy_command ${unifdef_EXECUTABLE} -USWIG -o ${staged_header} ${header} || (exit 0))
----------------
HemangGadhavi wrote:
@chelcassanova
For the `unifdef` binary, -o option is not available in some of the system like AIX, and its giving warning while building.
Is there any way to generate the output file ? may be using > operation ?
```
[362/3610] LLDB headers: stage LLDB headers in include directory
/usr/bin/unifdef: 1286-201 -o is not a recognized flag.
Usage: /usr/bin/unifdef [-t] [-l] [-c]
[[-DSymbol] [-USymbol] [-idSymbol] [-iuSymbol]] ... [File]
At least one parameter from [-D -U -id -iu] is required.
```
https://github.com/llvm/llvm-project/pull/141116
More information about the lldb-commits
mailing list