Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Clang] Reintroduce obsolete libclang symbols to avoid an ABI break#149079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Sirraide merged 3 commits intollvm:mainfromSirraide:arcmt-abi
Jul 16, 2025

Conversation

Sirraide
Copy link
Member

For more context, see#119269 (comment), but briefly, when removing ARCMigrate, I also removed some symbols in libclang, which constitutes an ABI break that we don’t want, so this pr reintroduces the removed symbols; the declarations are marked as deprecated for future removal, and the implementations print an error and do nothing, which is what we used to do when ARCMigrate was disabled.

@SirraideSirraide added the clang:as-a-librarylibclang and C++ API labelJul 16, 2025
@llvmbotllvmbot added the clangClang issues not falling into any other category labelJul 16, 2025
@llvmbot
Copy link
Member

@llvm/pr-subscribers-clang

Author: None (Sirraide)

Changes

For more context, see#119269 (comment), but briefly, when removing ARCMigrate, I also removed some symbols in libclang, which constitutes an ABI break that we don’t want, so this pr reintroduces the removed symbols; the declarations are marked as deprecated for future removal, and the implementations print an error and do nothing, which is what we used to do when ARCMigrate was disabled.


Full diff:https://github.com/llvm/llvm-project/pull/149079.diff

4 Files Affected:

  • (modified) clang/include/clang-c/Index.h (+15)
  • (modified) clang/tools/libclang/CMakeLists.txt (+1)
  • (added) clang/tools/libclang/Obsolete.cpp (+48)
  • (modified) llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn (+1)
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.hindex c35311c886413..b929585205aee 100644--- a/clang/include/clang-c/Index.h+++ b/clang/include/clang-c/Index.h@@ -6953,6 +6953,21 @@ clang_getCursorUnaryOperatorKind(CXCursor cursor);  * @}  */+CINDEX_DEPRECATED+typedef void *CXRemapping;++CINDEX_DEPRECATED CINDEX_LINKAGE CXRemapping clang_getRemappings(const char *);++CINDEX_DEPRECATED CINDEX_LINKAGE CXRemapping+clang_getRemappingsFromFileList(const char **, unsigned);++CINDEX_DEPRECATED CINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping);++CINDEX_DEPRECATED CINDEX_LINKAGE void+clang_remap_getFilenames(CXRemapping, unsigned, CXString *, CXString *);++CINDEX_DEPRECATED CINDEX_LINKAGE void clang_remap_dispose(CXRemapping);+ LLVM_CLANG_C_EXTERN_C_END  #endifdiff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txtindex b6662b66206b2..2b1e266f07392 100644--- a/clang/tools/libclang/CMakeLists.txt+++ b/clang/tools/libclang/CMakeLists.txt@@ -42,6 +42,7 @@ set(SOURCES   Indexing.cpp   FatalErrorHandler.cpp   Rewrite.cpp+  Obsolete.cpp    ADDITIONAL_HEADERS   CIndexDiagnostic.hdiff --git a/clang/tools/libclang/Obsolete.cpp b/clang/tools/libclang/Obsolete.cppnew file mode 100644index 0000000000000..3596f76e1be6f--- /dev/null+++ b/clang/tools/libclang/Obsolete.cpp@@ -0,0 +1,48 @@+//===- Obsolete.cpp - Obsolete libclang functions and types -------------===//+//+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.+// See https://llvm.org/LICENSE.txt for license information.+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception+//+//===--------------------------------------------------------------------===//+//+// This file contains libclang symbols whose underlying functionality has been+// removed from Clang, but which need to be kept around so as to retain ABI+// compatibility.+//+//===--------------------------------------------------------------------===//++#include "clang-c/CXString.h"+#include "clang-c/Index.h"+#include "clang-c/Platform.h"+#include "llvm/Support/raw_ostream.h"++extern "C" {++// The functions below used to be part of the C API for ARCMigrate, which has+// since been removed from Clang; they already used to print an error if Clang+// was compiled without arcmt support, so we continue doing so.+CXRemapping clang_getRemappings(const char *) {+  llvm::errs() << "error: ARCMigrate has been removed from Clang";+  return nullptr;+}++CXRemapping clang_getRemappingsFromFileList(const char **, unsigned) {+  llvm::errs() << "error: ARCMigrate has been removed from Clang";+  return nullptr;+}++unsigned clang_remap_getNumFiles(CXRemapping) {+  llvm::errs() << "error: ARCMigrate has been removed from Clang";+  return 0;+}++void clang_remap_getFilenames(CXRemapping, unsigned, CXString *, CXString *) {+  llvm::errs() << "error: ARCMigrate has been removed from Clang";+}++void clang_remap_dispose(CXRemapping) {+  llvm::errs() << "error: ARCMigrate has been removed from Clang";+}++} // extern "C"diff --git a/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn b/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gnindex 8f7beea152ab7..30b8bb61184bd 100644--- a/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn+++ b/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn@@ -87,6 +87,7 @@ shared_library("libclang") {     "Index_Internal.h",     "Indexing.cpp",     "Rewrite.cpp",+    "Obsolete.cpp",   ]   if (host_os == "mac") {     ldflags = [

Copy link
Contributor

@EndilllEndilll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM
This obviously has to be cherry-picked to the release branch.

Copy link
Collaborator

@AaronBallmanAaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM, thanks for the quick fix!

@SirraideSirraide merged commit1600450 intollvm:mainJul 16, 2025
14 checks passed
@SirraideSirraide added this to theLLVM 21.x Release milestoneJul 16, 2025
@Sirraide
Copy link
MemberAuthor

/cherry-pick1600450

@trutru moved this fromNeeds Triage toDone inLLVM Release StatusJul 16, 2025
@llvmbot
Copy link
Member

/pull-request#149100

@nico
Copy link
Contributor

Don't you have to undo the changes to clang/tools/libclang/libclang.map too? Else these might not be marked as exported on all platforms. (This:https://github.com/llvm/llvm-project/pull/119269/files#diff-2aa9e5e6908b0366b33796fa1f944b25d5b77abdf8eaceac7de55ccadaa7f04f)

@Sirraide
Copy link
MemberAuthor

Don't you have to undo the changes to clang/tools/libclang/libclang.map too? Else these might not be marked as exported on all platforms. (This:https://github.com/llvm/llvm-project/pull/119269/files#diff-2aa9e5e6908b0366b33796fa1f944b25d5b77abdf8eaceac7de55ccadaa7f04f)

CC@AaronBallman

@Sirraide
Copy link
MemberAuthor

I’ve opened#149190 for this.

nico pushed a commit that referenced this pull requestJul 16, 2025
This is a follow-up to#149079. Seems like we forgot about the fact thatthe symbols also need to be in `libclang.map`.
@llvm-ci
Copy link
Collaborator

LLVM Buildbot has detected a new failure on builderpremerge-monolithic-linux running onpremerge-linux-1 while buildingclang,llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at:https://lab.llvm.org/buildbot/#/builders/153/builds/38333

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)...PASS: lld :: COFF/defparser.test (98611 of 101609)PASS: lld :: COFF/delayimports-error.test (98612 of 101609)PASS: lld :: COFF/duplicate.test (98613 of 101609)PASS: lld :: COFF/duplicate-dwarf.s (98614 of 101609)PASS: lld :: COFF/arm64x-symtab.s (98615 of 101609)PASS: lld :: COFF/debug-fastlink.test (98616 of 101609)PASS: lld :: COFF/duplicate-absolute-same.s (98617 of 101609)PASS: lld :: COFF/dllexport-mingw.s (98618 of 101609)PASS: lld :: COFF/duplicate-absolute.s (98619 of 101609)TIMEOUT: MLIR :: Examples/standalone/test.toy (98620 of 101609)******************** TEST 'MLIR :: Examples/standalone/test.toy' FAILED ********************Exit Code: 1Timeout: Reached timeout of 60 secondsCommand Output (stdout):--# RUN: at line 1"/etc/cmake/bin/cmake" "/build/buildbot/premerge-monolithic-linux/llvm-project/mlir/examples/standalone" -G "Ninja"  -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang  -DLLVM_ENABLE_LIBCXX=OFF -DMLIR_DIR=/build/buildbot/premerge-monolithic-linux/build/lib/cmake/mlir  -DLLVM_USE_LINKER=lld  -DPython3_EXECUTABLE="/usr/bin/python3.10"# executed command: /etc/cmake/bin/cmake /build/buildbot/premerge-monolithic-linux/llvm-project/mlir/examples/standalone -G Ninja -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang -DLLVM_ENABLE_LIBCXX=OFF -DMLIR_DIR=/build/buildbot/premerge-monolithic-linux/build/lib/cmake/mlir -DLLVM_USE_LINKER=lld -DPython3_EXECUTABLE=/usr/bin/python3.10# .---command stdout------------# | -- The CXX compiler identification is Clang 16.0.6# | -- The C compiler identification is Clang 16.0.6# | -- Detecting CXX compiler ABI info# | -- Detecting CXX compiler ABI info - done# | -- Check for working CXX compiler: /usr/bin/clang++ - skipped# | -- Detecting CXX compile features# | -- Detecting CXX compile features - done# | -- Detecting C compiler ABI info# | -- Detecting C compiler ABI info - done# | -- Check for working C compiler: /usr/bin/clang - skipped# | -- Detecting C compile features# | -- Detecting C compile features - done# | -- Looking for histedit.h# | -- Looking for histedit.h - found# | -- Found LibEdit: /usr/include (found version "2.11") # | -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") # | -- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.13") # | -- Using MLIRConfig.cmake in: /build/buildbot/premerge-monolithic-linux/build/lib/cmake/mlir# | -- Using LLVMConfig.cmake in: /build/buildbot/premerge-monolithic-linux/build/lib/cmake/llvm# | -- Linker detection: unknown# | -- Performing Test LLVM_LIBSTDCXX_MIN# | -- Performing Test LLVM_LIBSTDCXX_MIN - Success# | -- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR# | -- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR - Success# | -- Performing Test CXX_SUPPORTS_CUSTOM_LINKER# | -- Performing Test CXX_SUPPORTS_CUSTOM_LINKER - Success# | -- Performing Test C_SUPPORTS_FPIC# | -- Performing Test C_SUPPORTS_FPIC - Success# | -- Performing Test CXX_SUPPORTS_FPIC

@llvm-ci
Copy link
Collaborator

LLVM Buildbot has detected a new failure on builderclang-s390x-linux running onsystemz-1 while buildingclang,llvm at step 5 "ninja check 1".

Full details are available at:https://lab.llvm.org/buildbot/#/builders/42/builds/5387

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)******************** TEST 'libFuzzer-s390x-default-Linux :: fuzzer-timeout.test' FAILED ********************Exit Code: 1Command Output (stderr):--/home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/./bin/clang    -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta   --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/fuzzer  /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/TimeoutTest.cpp -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest # RUN: at line 1+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/./bin/clang -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/fuzzer /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/TimeoutTest.cpp -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest/home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/./bin/clang    -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta   --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/fuzzer  /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/TimeoutEmptyTest.cpp -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutEmptyTest # RUN: at line 2+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/./bin/clang -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/fuzzer /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/TimeoutEmptyTest.cpp -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutEmptyTestnot  /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest -timeout=1 2>&1 | FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/fuzzer-timeout.test --check-prefix=TimeoutTest # RUN: at line 3+ not /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest -timeout=1+ FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/fuzzer-timeout.test --check-prefix=TimeoutTest/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/fuzzer-timeout.test:7:14: error: TimeoutTest: expected string not found in inputTimeoutTest: #0             ^<stdin>:19:43: note: scanning from here==306050== ERROR: libFuzzer: timeout after 1 seconds                                          ^<stdin>:24:104: note: possible intended match hereAddressSanitizer: CHECK failed: asan_report.cpp:227 "((current_error_.kind)) == ((kErrorKindInvalid))" (0x1, 0x0) (tid=306050)                                                                                                       ^Input file: <stdin>Check file: /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/fuzzer-timeout.test-dump-input=help explains the following input dump.Input was:<<<<<<           .           .           .          14: MS: 1 InsertByte-; base unit: 94dd9e08c129c785f7f256e82fbe0a30e6d1ae40           15: 0x48,0x69,0x21,           16: Hi!           17: artifact_prefix='./'; Test unit written to ./timeout-c0a0ad26a634840c67a210fefdda76577b03a111           18: Base64: SGkh           19: ==306050== ERROR: libFuzzer: timeout after 1 seconds check:7'0                                               X~~~~~~~~~~ error: no match found          20: AddressSanitizer:DEADLYSIGNAL check:7'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~          21: ================================================================= check:7'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~          22: AddressSanitizer:DEADLYSIGNAL check:7'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~          23: ================================================================= check:7'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~          24: AddressSanitizer: CHECK failed: asan_report.cpp:227 "((current_error_.kind)) == ((kErrorKindInvalid))" (0x1, 0x0) (tid=306050) check:7'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~check:7'1                                                                                                            ?                        possible intended match...

tru pushed a commit to llvmbot/llvm-project that referenced this pull requestJul 17, 2025
…lvm#149079)For more context, seellvm#119269 (comment),but briefly, when removing ARCMigrate, I also removed some symbols inlibclang, which constitutes an ABI break that we don’t want, so this prreintroduces the removed symbols; the declarations are marked asdeprecated for future removal, and the implementations print an errorand do nothing, which is what we used to do when ARCMigrate wasdisabled.(cherry picked from commit1600450)
tru pushed a commit to llvmbot/llvm-project that referenced this pull requestJul 17, 2025
This is a follow-up tollvm#149079. Seems like we forgot about the fact thatthe symbols also need to be in `libclang.map`.(cherry picked from commit7e0fde0)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@EndilllEndilllEndilll left review comments

@AaronBallmanAaronBallmanAaronBallman approved these changes

@efriedma-quicefriedma-quicAwaiting requested review from efriedma-quic

Assignees
No one assigned
Labels
clang:as-a-librarylibclang and C++ APIclangClang issues not falling into any other category
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants
@Sirraide@llvmbot@nico@llvm-ci@AaronBallman@Endilll

[8]ページ先頭

©2009-2025 Movatter.jp