Skip to content

Commit 00bbc15

Browse files
committed
only allow builtin iconv support
1 parent 4227cff commit 00bbc15

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

llvm/cmake/config-ix.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,9 @@ if(LLVM_ENABLE_ICONV)
283283
else()
284284
find_package(Iconv)
285285
endif()
286-
set(HAVE_ICONV ${Iconv_FOUND})
286+
if(Iconv_FOUND AND Iconv_IS_BUILT_IN)
287+
set(HAVE_ICONV 1)
288+
endif()
287289
endif()
288290

289291
# function checks

llvm/lib/Support/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,6 @@ if(ICU_FOUND)
302302
PRIVATE
303303
${ICU_LIBRARIES}
304304
)
305-
else()
306-
# Link iconv library if it is an external library.
307-
if(Iconv_FOUND AND NOT Iconv_IS_BUILT_IN)
308-
target_link_libraries(LLVMSupport
309-
PRIVATE
310-
${Iconv_LIBRARIES}
311-
)
312-
endif()
313305
endif()
314306

315307
set(llvm_system_libs ${system_libs})

llvm/lib/Support/CharSet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ std::error_code CharSetConverterIconv::convert(StringRef Source,
215215
// Setup the output. We directly write into the SmallVector.
216216
Result.resize_for_overwrite(Source.size());
217217
size_t Capacity = Result.capacity();
218-
char *Output = InputLength ? static_cast<char *>(Result.data()) : nullptr;
218+
char *Output = static_cast<char *>(Result.data());
219219
size_t OutputLength = Capacity;
220220

221221
size_t Ret;
@@ -265,7 +265,7 @@ std::error_code CharSetConverterIconv::flush() const {
265265

266266
std::error_code
267267
CharSetConverterIconv::flush(SmallVectorImpl<char> &Result) const {
268-
return convert(nullptr, Result);
268+
return convert("", Result, /*ShouldAutoFlush=*/true);
269269
}
270270

271271
#endif // HAVE_ICONV

0 commit comments

Comments
 (0)