-
Notifications
You must be signed in to change notification settings - Fork 11
CU-2083 Update scip-clang to newer Clang version #508
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
1ca46e8 to
41926df
Compare
| llvm::dyn_cast<clang::CXXRecordDecl>(baseType->getDecl()); | ||
| if (!baseRecord || !baseRecord->hasDefinition()) | ||
| continue; | ||
| auto baseResults = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CXXRecordDecl::lookupDependentName() was removed from the Clang API in LLVM 21. This is a local reimplementation with the same semantics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked up the reason why it was removed: llvm/llvm-project#128392. It seems there is a newer API that should be used instead (HeuristicResolver).
indexer/Indexer.cc
Outdated
| auto symbol = optSymbol.value(); | ||
|
|
||
| if (functionDecl.isPure() || functionDecl.isThisDeclarationADefinition()) { | ||
| if (functionDecl.isPureVirtual() || functionDecl.isThisDeclarationADefinition()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isPure() was renamed to isPureVirtual() in LLVM 21 for clarity.
| } | ||
| DERIVE_CMP_ALL(FileLocalSourceRange) | ||
| DERIVE_EQ_ALL(FileLocalSourceRange) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DERIVE_CMP_ALL now generates operator== via C++20 operator<=>, making DERIVE_EQ_ALL redundant and causing a compile error.
| @@ -0,0 +1,29 @@ | |||
| diff --git a/clang/lib/Tooling/Tooling.cpp b/clang/lib/Tooling/Tooling.cpp | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cherry-pick fix for CUDA assertion failure from llvm/llvm-project#173762. Can be removed once LLVM merges the fix.
| # LLVM 21 uses new naming convention: LLVM-VERSION-Platform.tar.xz | ||
| # with strip prefix LLVM-VERSION-Platform | ||
| grailbio_llvm_toolchain( | ||
| name = name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LLVM 21 changed release archive naming from clang+llvm-VERSION-TRIPLE to LLVM-VERSION-Platform.
| #include "boost/interprocess/ipc/message_queue.hpp" | ||
| #pragma clang diagnostic pop | ||
|
|
||
| #include "llvm/ADT/Optional.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
llvm::Optional was removed in favor of std::optional. This include is no longer needed.
88b71cb to
3480a7a
Compare
| @@ -52,7 +52,6 @@ | |||
| // ^^ reference local 5 | |||
|
|
|||
| g1<<<undeclared, 1>>>(42); // expected-error {{use of undeclared identifier 'undeclared'}} | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the line g1<<<undeclared, 1>>>(42);, when the kernel configuration contains an undeclared identifier (undeclared), Clang 21 no longer generates a DeclRefExpr for the callee function g1
3480a7a to
0fb5ccf
Compare
.bazelrc
Outdated
| common --enable_platform_specific_config | ||
|
|
||
| # Disable bzlmod for now - WORKSPACE dependencies not yet migrated | ||
| common --enable_bzlmod=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update to bazel 7 but we still use WORKSPACE not modules
0fb5ccf to
329783f
Compare
| # Based on release notes from since we're on Bazel < 7 | ||
| # https://github.com/bazel-contrib/toolchains_llvm/releases/tag/0.10.3 | ||
| build --features=-supports_dynamic_linker | ||
| build --features=-libtool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use bazel 7+ so no longer needed
| build --incompatible_enable_cc_toolchain_resolution | ||
|
|
||
| build --repo_env BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 | ||
| build --@llvm_zstd//:llvm_enable_zstd=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use bazel 7+ so no longer needed
faff6c7 to
235fa63
Compare
ea1763e to
3333e18
Compare
ed33a2f to
5aab1f5
Compare
5aab1f5 to
2d95b5c
Compare
https://github.com/sourcegraph/scip-clang/actions/runs/20861193543 |
07231da to
9b2b1b9
Compare
9b2b1b9 to
3c2472a
Compare
jupblb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix //tools:compdb and replace tryFindDeclForBaseType with HeuristicResolver.
.aspect/workflows/config.yaml
Outdated
| - build: | ||
| targets: | ||
| - //... | ||
| - -//tools:compdb # Exclude: com_grail_bazel_compdb is incompatible with current toolchain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that //tools:compdb is overall broken by this PR. This must be addressed as compile_commands.json is needed for local development (and C++ SCIP index generation). If there is an alternative way to generate this file that's also fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right of course.
I replaced:
load("@com_grail_bazel_compdb//:defs.bzl", "compilation_database")
with
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
Since compdb is unmaintained https://github.com/grailbio/bazel-compilation-database "This repository was archived by the owner on Mar 17, 2024. It is now read-only. "
| llvm::dyn_cast<clang::CXXRecordDecl>(baseType->getDecl()); | ||
| if (!baseRecord || !baseRecord->hasDefinition()) | ||
| continue; | ||
| auto baseResults = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked up the reason why it was removed: llvm/llvm-project#128392. It seems there is a newer API that should be used instead (HeuristicResolver).
| if bazel-bin/external/llvm_toolchain/clang-format --version >/dev/null 2>&1; then | ||
| CLANG_FORMAT="bazel-bin/external/llvm_toolchain/clang-format" | ||
| elif command -v clang-format >/dev/null 2>&1; then | ||
| echo "Warning: Using system clang-format (LLVM toolchain version not compatible with this system)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still an issue on newer OS like macOS Tahoe or Ubuntu 24.04? If not, I'd revert these changes.
| strip_prefix = "abseil-cpp-%s" % _ABSL_COMMIT, | ||
| urls = ["https://github.com/abseil/abseil-cpp/archive/%s.zip" % _ABSL_COMMIT], | ||
| patch_args = ["-p1"], | ||
| patches = ["//third_party:abseil.patch"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File with this patch can be removed.
| # On Linux, use the bundled libc++ (builtin-libc++) for hermetic builds. | ||
| stdlib = { | ||
| "darwin-aarch64": "libc++", | ||
| "darwin-x86_64": "libc++", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should drop support for darwin-x86_64 (can be done in another PR).
|
|
||
| # macOS SDK path for system libc++ headers | ||
| # This is the standard location for Xcode Command Line Tools SDK | ||
| _MACOS_SDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment that this variable should be set to xcrun --show-sdk-path output.
| ## IDE integration | ||
|
|
||
| Run `./tools/regenerate-compdb.sh` to generate a compilation database | ||
| Run `./tools/regenerate-compile-commands.sh` to generate a compilation database |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since compdb has been removed, I renamed this tool to avoid confusion and coupling with underlaying tool name
c3872c4 to
c4e0b9b
Compare
| self.arguments = shlex.split(entry["command"]) | ||
| except KeyError: | ||
| self.arguments = entry(["arguments"]) | ||
| self.arguments = entry["arguments"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bugfix in error handling
c4e0b9b to
9636366
Compare
tools/regenerate-compdb.sh
Outdated
| # The --features flags disable module_maps which is incompatible with the | ||
| # grailbio/bazel-compilation-database library (archived, no longer maintained). | ||
| # See: https://github.com/grailbio/bazel-compilation-database/issues/101 | ||
| bazel build //tools:compdb --features=-layering_check --features=-module_maps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem to me that we use com_grail_bazel_compdb anymore? What is the consequence of disabling module_maps and layering_check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, noticed #508 (comment)
Update scip-clang to newer Clang 21 version