diff --git a/test/k-rule-apply/definition.kore b/test/k-rule-apply/definition.kore index 1b039b0e1..92e1a5ab1 100644 --- a/test/k-rule-apply/definition.kore +++ b/test/k-rule-apply/definition.kore @@ -1,3 +1,4 @@ +// XFAIL: opaque-pointers // RUN: %kompile %s c // RUN: %apply-rule %S TEST.testArray %input-dir/`basename %S`/foo_Array_Success.in %S/definition.o | diff - %output-dir/`basename %S`/foo_Array_Success.out.diff // RUN: %apply-rule %S TEST.testArray %input-dir/`basename %S`/foo_Array_Fail.in %S/definition.o | diff - %output-dir/`basename %S`/foo_Array_Fail.out.diff diff --git a/test/lit.cfg.py b/test/lit.cfg.py index b75a48f59..ab3ce3263 100644 --- a/test/lit.cfg.py +++ b/test/lit.cfg.py @@ -1,8 +1,17 @@ import glob import os +import subprocess from lit import formats +def llvm_major_version(): + result = subprocess.run(['llvm-backend-version', '--llvm'], capture_output=True) + if result.returncode != 0: + raise RuntimeError('Failed to get LLVM package version') + + major, _, _ = result.stdout.decode('utf-8').strip().split('.') + return int(major) + ROOT_PATH = os.path.realpath(os.path.join( os.path.dirname(os.path.realpath(__file__)), "..")) @@ -39,6 +48,9 @@ 'test_bindings.py' ] +if llvm_major_version() >= 16: + config.available_features.add('opaque-pointers') + # When lit is launched, it doesn't inherit any environment variables from the # parent process' environment. This breaks the Nix derivations for the host # compiler and linker, as they depend on NIX_* environment variables being set. diff --git a/tools/llvm-backend-version/version.cpp b/tools/llvm-backend-version/version.cpp index 335fabc05..582d0f694 100644 --- a/tools/llvm-backend-version/version.cpp +++ b/tools/llvm-backend-version/version.cpp @@ -1,7 +1,23 @@ #include "version.inc" -#include +#include +#include -int main() { - printf("%s\n", llvm_backend_version); +using namespace llvm; + +cl::OptionCategory VersionCat("kprint options"); + +cl::opt LLVMVersion( + "llvm", cl::desc("Print LLVM version rather than backend version"), + cl::cat(VersionCat)); + +int main(int argc, char **argv) { + cl::HideUnrelatedOptions({&VersionCat}); + cl::ParseCommandLineOptions(argc, argv); + + if (LLVMVersion) { + llvm::outs() << llvm_version << '\n'; + } else { + llvm::outs() << llvm_backend_version << '\n'; + } } diff --git a/tools/llvm-backend-version/version.inc.in b/tools/llvm-backend-version/version.inc.in index 7d65fda4b..4eb0f0cc5 100644 --- a/tools/llvm-backend-version/version.inc.in +++ b/tools/llvm-backend-version/version.inc.in @@ -1 +1,2 @@ static const char llvm_backend_version[] = "@LLVM_BACKEND_VERSION@"; +static const char llvm_version[] = "@LLVM_PACKAGE_VERSION@";