From ac72a8661905a7f1bb3f36b7ffae2b0b42452843 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Wed, 3 Mar 2021 17:06:23 +0530 Subject: [PATCH 01/36] Update cpt to handle new LLVM 9 dependency Non-LLVM binary builds work --- tools/packaging/cpt.py | 59 ++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index d1709c22a..97df51f41 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -266,21 +266,36 @@ def download_llvm_binary(): -DLLVM_TOOLS_BINARY_DIR={5} -DLLVM_TOOL_CLING_BUILD=ON".format(srcdir, os.path.join(srcdir, 'bin', 'llvm-config'), os.path.join(srcdir, 'lib'), os.path.join(srcdir, 'include'), os.path.join(srcdir, 'bin', 'llvm-tblgen'), os.path.join(srcdir, 'bin')) - if DIST=="Ubuntu" and REV=='16.04' and is_os_64bit(): - download_link = 'http://releases.llvm.org/5.0.2/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04.tar.xz' + if DIST=="Ubuntu" and REV=='14.04' and is_os_64bit(): + assert llvm_revision == "release_90" + download_link = 'https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz' exec_subprocess_call('wget %s' % download_link, workdir) - exec_subprocess_call('tar xvf clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04.tar.xz', workdir) - exec_subprocess_call('mv clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04 %s' % srcdir, workdir) - elif DIST=="Ubuntu" and REV=='14.04' and is_os_64bit(): - download_link = 'http://releases.llvm.org/5.0.2/clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-14.04.tar.xz' + exec_subprocess_call('tar xvf clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz', workdir) + exec_subprocess_call('mv clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-14.04 %s' % srcdir, workdir) + elif DIST=="Ubuntu" and REV=='16.04' and is_os_64bit(): + assert llvm_revision == "release_90" + download_link = 'https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz' exec_subprocess_call('wget %s' % download_link, workdir) - exec_subprocess_call('tar xvf clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-14.04.tar.xz', workdir) - exec_subprocess_call('mv clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-14.04 %s' % srcdir, workdir) + exec_subprocess_call('tar xvf clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz', workdir) + exec_subprocess_call('mv clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04 %s' % srcdir, workdir) + elif DIST=="Ubuntu" and REV=='18.04' and is_os_64bit(): + assert llvm_revision == "release_90" + download_link = 'https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz' + exec_subprocess_call('wget %s' % download_link, workdir) + exec_subprocess_call('tar xvf clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz', workdir) + exec_subprocess_call('mv clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04 %s' % srcdir, workdir) + elif DIST=="Ubuntu" and REV=='19.04' and is_os_64bit(): + assert llvm_revision == "release_90" + download_link = 'https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-pc-linux-gnu.tar.xz' + exec_subprocess_call('wget %s' % download_link, workdir) + exec_subprocess_call('tar xvf clang+llvm-9.0.0-x86_64-pc-linux-gnu.tar.xz', workdir) + exec_subprocess_call('mv clang+llvm-9.0.0-x86_64-pc-linux-gnu %s' % srcdir, workdir) elif DIST=='MacOSX' and is_os_64bit(): - download_link = 'http://releases.llvm.org/5.0.2/clang+llvm-5.0.2-x86_64-apple-darwin.tar.xz' + assert llvm_revision == "release_90" + download_link = 'https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-darwin-apple.tar.xz' exec_subprocess_call('wget %s' % download_link, workdir) - exec_subprocess_call('tar xvf clang+llvm-5.0.2-x86_64-apple-darwin.tar.xz', workdir) - exec_subprocess_call('sudo mv clang+llvm-5.0.2-x86_64-apple-darwin %s' % srcdir, workdir) + exec_subprocess_call('tar xvf clang+llvm-9.0.0-x86_64-darwin-apple.tar.xz', workdir) + exec_subprocess_call('sudo mv clang+llvm-9.0.0-x86_64-darwin-apple %s' % srcdir, workdir) else: raise Exception("Building clang using LLVM binary not possible. Please invoke cpt without --with-binary-llvm and --with-llvm-tar flags") # FIXME: Add Fedora and SUSE support @@ -431,14 +446,16 @@ def set_vars(): if not os.path.isfile(os.path.join(LLVM_OBJ_ROOT, 'test', 'lit.site.cfg')): if not os.path.exists(os.path.join(LLVM_OBJ_ROOT, 'test')): os.mkdir(os.path.join(LLVM_OBJ_ROOT, 'test')) - exec_subprocess_call('make lit.site.cfg', os.path.join(LLVM_OBJ_ROOT, 'test')) + #exec_subprocess_call('make lit.site.cfg', os.path.join(LLVM_OBJ_ROOT, 'test')) + ''' with open(os.path.join(LLVM_OBJ_ROOT, 'test', 'lit.site.cfg'), 'r') as lit_site_cfg: for line in lit_site_cfg: if re.match('^config.llvm_shlib_ext = ', line): SHLIBEXT = re.sub('^config.llvm_shlib_ext = ', '', line).replace('"', '').strip() elif re.match('^config.llvm_exe_ext = ', line): EXEEXT = re.sub('^config.llvm_exe_ext = ', '', line).replace('"', '').strip() + ''' if not os.path.isfile(os.path.join(LLVM_OBJ_ROOT, 'tools', 'clang', 'include', 'clang', 'Basic', 'Version.inc')): exec_subprocess_call('make Version.inc', @@ -490,6 +507,17 @@ def allow_clang_tool(): with open(os.path.join(workdir, 'clang', 'tools', 'CMakeLists.txt'), 'a') as file: file.writelines('add_llvm_external_project(cling)') +''' +def apply_llvm_patches(): + llvm_dir = exec_subprocess_check_output("llvm-config --src-root", ".").strip() + if llvm_dir == "": + if tar_required: + llvm_dir = copy.copy(srcdir) + else: + llvm_dir = os.path.join("/usr", "lib", "llvm-" + llvm_vers, "build") + subprocess. +''' + class Build(object): def __init__(self, target=None): if args.get('create_dev_env'): @@ -551,6 +579,8 @@ def compile(arg): cmake_config_flags = (srcdir + ' -DLLVM_BUILD_TOOLS=Off -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} ' .format(build.buildType, TMP_PREFIX) + ' -DLLVM_TARGETS_TO_BUILD="host;NVPTX" ' + EXTRA_CMAKE_FLAGS) + if os.path.exists(exec_subprocess_check_output("which lit", "/").strip()): + cmake_config_flags += "-DLLVM_EXTERNAL_LIT=" + exec_subprocess_check_output("which lit", "/").strip() # configure cling build.config(cmake_config_flags) @@ -731,7 +761,7 @@ def setup_tests(): file.writelines('add_subdirectory(\"FileCheck\")') exec_subprocess_call("cmake {0}".format(LLVM_OBJ_ROOT), CLING_SRC_DIR) exec_subprocess_call("cmake --build . --target FileCheck -- -j{0}".format(multiprocessing.cpu_count()), LLVM_OBJ_ROOT) - if not os.path.exists(os.path.join(CLING_SRC_DIR, "..", "clang", "test")): + if not os.path.exists(os.path.join(CLING_SRC_DIR, "..", "clang", "test")) and os.path.exists(exec_subprocess_check_output("which lit").split()): llvm_dir = exec_subprocess_check_output("llvm-config --src-root", ".").strip() if llvm_dir == "": if tar_required: @@ -1853,9 +1883,6 @@ def custom_input(prompt, always_yes=False): EXTRA_CMAKE_FLAGS = args.get('with_cmake_flags') CMAKE = os.environ.get('CMAKE', None) -# llvm_revision = urlopen( -# "https://raw.githubusercontent.com/root-project/cling/master/LastKnownGoodLLVMSVNRevision.txt").readline().strip().decode( -# 'utf-8') VERSION = '' REVISION = '' # Travis needs some special behaviour From 07ed7fb9105451880c4ddef7870d53069737fdeb Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Tue, 9 Mar 2021 17:34:04 +0530 Subject: [PATCH 02/36] Fix Cling build using LLVM 9 binary Do not allow building using system LLVM to avoid patching it. --- patches/llvm90/Add-missing-includes.diff | 13 ++++++++ patches/llvm90/Fix-the-compilation.diff | 13 ++++++++ patches/llvm90/Make-datamember-protected.diff | 14 +++++++++ tools/packaging/cpt.py | 30 +++++++++++++++---- 4 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 patches/llvm90/Add-missing-includes.diff create mode 100644 patches/llvm90/Fix-the-compilation.diff create mode 100644 patches/llvm90/Make-datamember-protected.diff diff --git a/patches/llvm90/Add-missing-includes.diff b/patches/llvm90/Add-missing-includes.diff new file mode 100644 index 000000000..f9dda0545 --- /dev/null +++ b/patches/llvm90/Add-missing-includes.diff @@ -0,0 +1,13 @@ +diff --git a/include/llvm/Demangle/MicrosoftDemangleNodes.h b/include/llvm/Demangle/MicrosoftDemangleNodes.h +index da9d9d5bfdc..3d47471f0ef 100644 +--- a/include/llvm/Demangle/MicrosoftDemangleNodes.h ++++ b/include/llvm/Demangle/MicrosoftDemangleNodes.h +@@ -16,6 +16,8 @@ + #include "llvm/Demangle/DemangleConfig.h" + #include "llvm/Demangle/StringView.h" + #include ++#include ++#include + + namespace llvm { + namespace itanium_demangle { diff --git a/patches/llvm90/Fix-the-compilation.diff b/patches/llvm90/Fix-the-compilation.diff new file mode 100644 index 000000000..07daa65c5 --- /dev/null +++ b/patches/llvm90/Fix-the-compilation.diff @@ -0,0 +1,13 @@ +diff --git a/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h b/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h +index 16202d89f86..3afdac3438b 100644 +--- a/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h ++++ b/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h +@@ -220,7 +220,7 @@ public: + Error removeModule(VModuleKey K) { + auto I = ModuleMap.find(K); + assert(I != ModuleMap.end() && "VModuleKey K not valid here"); +- auto EDM = std::move(I.second); ++ auto EDM = std::move(I->second); + ModuleMap.erase(I); + return EDM->removeModuleFromBaseLayer(BaseLayer); + } diff --git a/patches/llvm90/Make-datamember-protected.diff b/patches/llvm90/Make-datamember-protected.diff new file mode 100644 index 000000000..b4fd64fa9 --- /dev/null +++ b/patches/llvm90/Make-datamember-protected.diff @@ -0,0 +1,14 @@ +diff --git a/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h b/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h +index d9535ce5f21..4c688c3da84 100644 +--- a/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h ++++ b/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h +@@ -472,7 +472,9 @@ private: + + // NB! `LinkedObjects` needs to be destroyed before `NotifyFreed` because + // `~ConcreteLinkedObject` calls `NotifyFreed` ++protected: + std::map> LinkedObjects; ++private: + bool ProcessAllSections = false; + }; + diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 97df51f41..1522f0d4f 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -422,6 +422,10 @@ def update_old_cling(): else: get_fresh_cling() + # Only till we need the LLVM 9 patches + if tar_required: + apply_llvm_patches() + def set_version(): global VERSION global REVISION @@ -507,16 +511,25 @@ def allow_clang_tool(): with open(os.path.join(workdir, 'clang', 'tools', 'CMakeLists.txt'), 'a') as file: file.writelines('add_llvm_external_project(cling)') -''' + +# Only for LLVM 9 def apply_llvm_patches(): + assert llvm_revision == "release_90" + # Get llvm path llvm_dir = exec_subprocess_check_output("llvm-config --src-root", ".").strip() if llvm_dir == "": if tar_required: llvm_dir = copy.copy(srcdir) else: llvm_dir = os.path.join("/usr", "lib", "llvm-" + llvm_vers, "build") - subprocess. -''' + # Move patches to correct location + for f in os.listdir(os.path.join(CLING_SRC_DIR, "patches", "llvm90")): + if f.endswith(".diff"): + shutil.move(os.path.join(CLING_SRC_DIR, "patches", "llvm90", f), llvm_dir) + # Apply patches + for f in os.listdir(llvm_dir): + if f.endswith(".diff"): + subprocess.run("patch -p1 < {0}".format(f), cwd=llvm_dir, shell=True) class Build(object): def __init__(self, target=None): @@ -1827,7 +1840,8 @@ def make_dmg(): parser.add_argument('--cling-branch', help='Specify a particular Cling branch') parser.add_argument('--with-binary-llvm', help='Download LLVM binary and use it to build Cling in dev mode', action='store_true') -parser.add_argument('--with-llvm-tar', help='Download and use LLVM binary release tar to build Cling for debugging', action='store_true') +# FIXME: Marked as inactive till we want to build using system installed LLVM +parser.add_argument('--with-llvm-tar', help='[INACTIVE] Download and use LLVM binary release tar to build Cling for debugging', action='store_true') parser.add_argument('--no-test', help='Do not run test suite of Cling', action='store_true') parser.add_argument('--skip-cleanup', help='Do not clean up after a build', action='store_true') parser.add_argument('--use-wget', help='Do not use Git to fetch sources', action='store_true') @@ -1876,7 +1890,7 @@ def custom_input(prompt, always_yes=False): llvm_revision = urlopen( "https://raw.githubusercontent.com/root-project/cling/master/LastKnownGoodLLVMSVNRevision.txt").readline().strip().decode( 'utf-8') -llvm_vers = "{0}.{1}".format(llvm_revision[-2], llvm_revision[-1]) +llvm_vers = llvm_revision[-2] LLVM_GIT_URL = "" CLANG_GIT_URL = args['with_clang_url'] CLING_GIT_URL = args['with_cling_url'] @@ -1999,7 +2013,8 @@ def custom_input(prompt, always_yes=False): else: LLVM_GIT_URL = "http://root.cern.ch/git/llvm.git" -if args['with_llvm_tar']: +# FIXME: Remove with_binary_llvm check when we want to build using system installed LLVM +if args['with_llvm_tar'] or args["with_binary_llvm"]: tar_required = True if args['check_requirements']: @@ -2010,9 +2025,12 @@ def custom_input(prompt, always_yes=False): prerequisite = ['git', 'cmake', 'gcc', 'g++', 'debhelper', 'devscripts', 'gnupg', 'zlib1g-dev'] if args["with_binary_llvm"] or args["with_llvm_tar"]: prerequisite.extend(['subversion']) + # FIXME: Uncomment when we want to build using system installed LLVM + ''' if args["with_binary_llvm"] and not args["with_llvm_tar"]: if check_ubuntu('llvm-'+llvm_vers+'-dev') is False: llvm_binary_name = 'llvm-{0}-dev'.format(llvm_vers) + ''' for pkg in prerequisite: if check_ubuntu(pkg) is False: install_line += pkg + ' ' From 1041b1d44747b847d9d6b1a7b318933972486df0 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 19 Mar 2021 21:15:54 +0530 Subject: [PATCH 03/36] Different approach to build using binary LLVM Disable tar builds and use -isystem flag to point to patched headers --- .github/workflows/ci.yml | 6 +- patches/llvm90-headers/LazyEmittingLayer.h | 271 ++++++++++ patches/llvm90-headers/MicrosoftDemangle.h | 277 ++++++++++ .../llvm90-headers/RTDyldObjectLinkingLayer.h | 484 ++++++++++++++++++ patches/llvm90/Add-missing-includes.diff | 13 - patches/llvm90/Fix-the-compilation.diff | 13 - patches/llvm90/Make-datamember-protected.diff | 14 - tools/packaging/cpt.py | 45 +- 8 files changed, 1050 insertions(+), 73 deletions(-) create mode 100644 patches/llvm90-headers/LazyEmittingLayer.h create mode 100644 patches/llvm90-headers/MicrosoftDemangle.h create mode 100644 patches/llvm90-headers/RTDyldObjectLinkingLayer.h delete mode 100644 patches/llvm90/Add-missing-includes.diff delete mode 100644 patches/llvm90/Fix-the-compilation.diff delete mode 100644 patches/llvm90/Make-datamember-protected.diff diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f7a4e699..cab2ca934 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: os: ubuntu-20.04 compiler: clang - - name: macos-10.15-xcode-11.2.1-fromtar + - name: macos-10.15-xcode-11.2.1 os: macOS-10.15 compiler: clang xcode-version: "11.2.1" @@ -97,8 +97,8 @@ jobs: export CLING_BUILD_FLAGS="$CLING_BUILD_FLAGS -DCLANG_ENABLE_ARCMT=OFF -DCLANG_ENABLE_STATIC_ANALYZER=OFF -DLLVM_ENABLE_WARNINGS=OFF -DCLING_ENABLE_WARNINGS=ON" if [[ ${{ matrix.name }} == *"compile"* ]]; then python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} - elif [[ ${{ matrix.name }} == *"fromtar"* ]]; then - python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --with-llvm-tar + # elif [[ ${{ matrix.name }} == *"fromtar"* ]]; then + # python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --with-llvm-tar else python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm fi diff --git a/patches/llvm90-headers/LazyEmittingLayer.h b/patches/llvm90-headers/LazyEmittingLayer.h new file mode 100644 index 000000000..3afdac343 --- /dev/null +++ b/patches/llvm90-headers/LazyEmittingLayer.h @@ -0,0 +1,271 @@ +//===- LazyEmittingLayer.h - Lazily emit IR to lower JIT layers -*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Contains the definition for a lazy-emitting layer for the JIT. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_EXECUTIONENGINE_ORC_LAZYEMITTINGLAYER_H +#define LLVM_EXECUTIONENGINE_ORC_LAZYEMITTINGLAYER_H + +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ExecutionEngine/JITSymbol.h" +#include "llvm/ExecutionEngine/Orc/Core.h" +#include "llvm/IR/GlobalValue.h" +#include "llvm/IR/Mangler.h" +#include "llvm/IR/Module.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" +#include +#include +#include +#include +#include + +namespace llvm { +namespace orc { + +/// Lazy-emitting IR layer. +/// +/// This layer accepts LLVM IR Modules (via addModule) but does not +/// immediately emit them the layer below. Instead, emission to the base layer +/// is deferred until the first time the client requests the address (via +/// JITSymbol::getAddress) for a symbol contained in this layer. +template class LazyEmittingLayer { +private: + class EmissionDeferredModule { + public: + EmissionDeferredModule(VModuleKey K, std::unique_ptr M) + : K(std::move(K)), M(std::move(M)) {} + + JITSymbol find(StringRef Name, bool ExportedSymbolsOnly, BaseLayerT &B) { + switch (EmitState) { + case NotEmitted: + if (auto GV = searchGVs(Name, ExportedSymbolsOnly)) { + // Create a std::string version of Name to capture here - the argument + // (a StringRef) may go away before the lambda is executed. + // FIXME: Use capture-init when we move to C++14. + std::string PName = Name; + JITSymbolFlags Flags = JITSymbolFlags::fromGlobalValue(*GV); + auto GetAddress = + [this, ExportedSymbolsOnly, PName, &B]() -> Expected { + if (this->EmitState == Emitting) + return 0; + else if (this->EmitState == NotEmitted) { + this->EmitState = Emitting; + if (auto Err = this->emitToBaseLayer(B)) + return std::move(Err); + this->EmitState = Emitted; + } + if (auto Sym = B.findSymbolIn(K, PName, ExportedSymbolsOnly)) + return Sym.getAddress(); + else if (auto Err = Sym.takeError()) + return std::move(Err); + else + llvm_unreachable("Successful symbol lookup should return " + "definition address here"); + }; + return JITSymbol(std::move(GetAddress), Flags); + } else + return nullptr; + case Emitting: + // Calling "emit" can trigger a recursive call to 'find' (e.g. to check + // for pre-existing definitions of common-symbol), but any symbol in + // this module would already have been found internally (in the + // RuntimeDyld that did the lookup), so just return a nullptr here. + return nullptr; + case Emitted: + return B.findSymbolIn(K, Name, ExportedSymbolsOnly); + } + llvm_unreachable("Invalid emit-state."); + } + + Error removeModuleFromBaseLayer(BaseLayerT& BaseLayer) { + return EmitState != NotEmitted ? BaseLayer.removeModule(K) + : Error::success(); + } + + void emitAndFinalize(BaseLayerT &BaseLayer) { + assert(EmitState != Emitting && + "Cannot emitAndFinalize while already emitting"); + if (EmitState == NotEmitted) { + EmitState = Emitting; + emitToBaseLayer(BaseLayer); + EmitState = Emitted; + } + BaseLayer.emitAndFinalize(K); + } + + private: + + const GlobalValue* searchGVs(StringRef Name, + bool ExportedSymbolsOnly) const { + // FIXME: We could clean all this up if we had a way to reliably demangle + // names: We could just demangle name and search, rather than + // mangling everything else. + + // If we have already built the mangled name set then just search it. + if (MangledSymbols) { + auto VI = MangledSymbols->find(Name); + if (VI == MangledSymbols->end()) + return nullptr; + auto GV = VI->second; + if (!ExportedSymbolsOnly || GV->hasDefaultVisibility()) + return GV; + return nullptr; + } + + // If we haven't built the mangled name set yet, try to build it. As an + // optimization this will leave MangledNames set to nullptr if we find + // Name in the process of building the set. + return buildMangledSymbols(Name, ExportedSymbolsOnly); + } + + Error emitToBaseLayer(BaseLayerT &BaseLayer) { + // We don't need the mangled names set any more: Once we've emitted this + // to the base layer we'll just look for symbols there. + MangledSymbols.reset(); + return BaseLayer.addModule(std::move(K), std::move(M)); + } + + // If the mangled name of the given GlobalValue matches the given search + // name (and its visibility conforms to the ExportedSymbolsOnly flag) then + // return the symbol. Otherwise, add the mangled name to the Names map and + // return nullptr. + const GlobalValue* addGlobalValue(StringMap &Names, + const GlobalValue &GV, + const Mangler &Mang, StringRef SearchName, + bool ExportedSymbolsOnly) const { + // Modules don't "provide" decls or common symbols. + if (GV.isDeclaration() || GV.hasCommonLinkage()) + return nullptr; + + // Mangle the GV name. + std::string MangledName; + { + raw_string_ostream MangledNameStream(MangledName); + Mang.getNameWithPrefix(MangledNameStream, &GV, false); + } + + // Check whether this is the name we were searching for, and if it is then + // bail out early. + if (MangledName == SearchName) + if (!ExportedSymbolsOnly || GV.hasDefaultVisibility()) + return &GV; + + // Otherwise add this to the map for later. + Names[MangledName] = &GV; + return nullptr; + } + + // Build the MangledSymbols map. Bails out early (with MangledSymbols left set + // to nullptr) if the given SearchName is found while building the map. + const GlobalValue* buildMangledSymbols(StringRef SearchName, + bool ExportedSymbolsOnly) const { + assert(!MangledSymbols && "Mangled symbols map already exists?"); + + auto Symbols = llvm::make_unique>(); + + Mangler Mang; + + for (const auto &GO : M->global_objects()) + if (auto GV = addGlobalValue(*Symbols, GO, Mang, SearchName, + ExportedSymbolsOnly)) + return GV; + + MangledSymbols = std::move(Symbols); + return nullptr; + } + + enum { NotEmitted, Emitting, Emitted } EmitState = NotEmitted; + VModuleKey K; + std::unique_ptr M; + mutable std::unique_ptr> MangledSymbols; + }; + + BaseLayerT &BaseLayer; + std::map> ModuleMap; + +public: + + /// Construct a lazy emitting layer. + LLVM_ATTRIBUTE_DEPRECATED( + LazyEmittingLayer(BaseLayerT &BaseLayer), + "ORCv1 layers (including LazyEmittingLayer) are deprecated. Please use " + "ORCv2, where lazy emission is the default"); + + /// Construct a lazy emitting layer. + LazyEmittingLayer(ORCv1DeprecationAcknowledgement, BaseLayerT &BaseLayer) + : BaseLayer(BaseLayer) {} + + /// Add the given module to the lazy emitting layer. + Error addModule(VModuleKey K, std::unique_ptr M) { + assert(!ModuleMap.count(K) && "VModuleKey K already in use"); + ModuleMap[K] = + llvm::make_unique(std::move(K), std::move(M)); + return Error::success(); + } + + /// Remove the module represented by the given handle. + /// + /// This method will free the memory associated with the given module, both + /// in this layer, and the base layer. + Error removeModule(VModuleKey K) { + auto I = ModuleMap.find(K); + assert(I != ModuleMap.end() && "VModuleKey K not valid here"); + auto EDM = std::move(I->second); + ModuleMap.erase(I); + return EDM->removeModuleFromBaseLayer(BaseLayer); + } + + /// Search for the given named symbol. + /// @param Name The name of the symbol to search for. + /// @param ExportedSymbolsOnly If true, search only for exported symbols. + /// @return A handle for the given named symbol, if it exists. + JITSymbol findSymbol(const std::string &Name, bool ExportedSymbolsOnly) { + // Look for the symbol among existing definitions. + if (auto Symbol = BaseLayer.findSymbol(Name, ExportedSymbolsOnly)) + return Symbol; + + // If not found then search the deferred modules. If any of these contain a + // definition of 'Name' then they will return a JITSymbol that will emit + // the corresponding module when the symbol address is requested. + for (auto &KV : ModuleMap) + if (auto Symbol = KV.second->find(Name, ExportedSymbolsOnly, BaseLayer)) + return Symbol; + + // If no definition found anywhere return a null symbol. + return nullptr; + } + + /// Get the address of the given symbol in the context of the of + /// compiled modules represented by the key K. + JITSymbol findSymbolIn(VModuleKey K, const std::string &Name, + bool ExportedSymbolsOnly) { + assert(ModuleMap.count(K) && "VModuleKey K not valid here"); + return ModuleMap[K]->find(Name, ExportedSymbolsOnly, BaseLayer); + } + + /// Immediately emit and finalize the module represented by the given + /// key. + Error emitAndFinalize(VModuleKey K) { + assert(ModuleMap.count(K) && "VModuleKey K not valid here"); + return ModuleMap[K]->emitAndFinalize(BaseLayer); + } +}; + +template +LazyEmittingLayer::LazyEmittingLayer(BaseLayerT &BaseLayer) + : BaseLayer(BaseLayer) {} + +} // end namespace orc +} // end namespace llvm + +#endif // LLVM_EXECUTIONENGINE_ORC_LAZYEMITTINGLAYER_H diff --git a/patches/llvm90-headers/MicrosoftDemangle.h b/patches/llvm90-headers/MicrosoftDemangle.h new file mode 100644 index 000000000..382e79401 --- /dev/null +++ b/patches/llvm90-headers/MicrosoftDemangle.h @@ -0,0 +1,277 @@ +//===------------------------- MicrosoftDemangle.h --------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEMANGLE_MICROSOFT_DEMANGLE_H +#define LLVM_DEMANGLE_MICROSOFT_DEMANGLE_H + +#include "llvm/Demangle/DemangleConfig.h" +#include "llvm/Demangle/MicrosoftDemangleNodes.h" +#include "llvm/Demangle/StringView.h" +#include "llvm/Demangle/Utility.h" + +#include + +namespace llvm { +namespace ms_demangle { +// This memory allocator is extremely fast, but it doesn't call dtors +// for allocated objects. That means you can't use STL containers +// (such as std::vector) with this allocator. But it pays off -- +// the demangler is 3x faster with this allocator compared to one with +// STL containers. +constexpr size_t AllocUnit = 4096; + +class ArenaAllocator { + struct AllocatorNode { + uint8_t *Buf = nullptr; + size_t Used = 0; + size_t Capacity = 0; + AllocatorNode *Next = nullptr; + }; + + void addNode(size_t Capacity) { + AllocatorNode *NewHead = new AllocatorNode; + NewHead->Buf = new uint8_t[Capacity]; + NewHead->Next = Head; + NewHead->Capacity = Capacity; + Head = NewHead; + NewHead->Used = 0; + } + +public: + ArenaAllocator() { addNode(AllocUnit); } + + ~ArenaAllocator() { + while (Head) { + assert(Head->Buf); + delete[] Head->Buf; + AllocatorNode *Next = Head->Next; + delete Head; + Head = Next; + } + } + + char *allocUnalignedBuffer(size_t Size) { + assert(Head && Head->Buf); + + uint8_t *P = Head->Buf + Head->Used; + + Head->Used += Size; + if (Head->Used <= Head->Capacity) + return reinterpret_cast(P); + + addNode(std::max(AllocUnit, Size)); + Head->Used = Size; + return reinterpret_cast(Head->Buf); + } + + template T *allocArray(size_t Count) { + size_t Size = Count * sizeof(T); + assert(Head && Head->Buf); + + size_t P = (size_t)Head->Buf + Head->Used; + uintptr_t AlignedP = + (((size_t)P + alignof(T) - 1) & ~(size_t)(alignof(T) - 1)); + uint8_t *PP = (uint8_t *)AlignedP; + size_t Adjustment = AlignedP - P; + + Head->Used += Size + Adjustment; + if (Head->Used <= Head->Capacity) + return new (PP) T[Count](); + + addNode(std::max(AllocUnit, Size)); + Head->Used = Size; + return new (Head->Buf) T[Count](); + } + + template T *alloc(Args &&... ConstructorArgs) { + constexpr size_t Size = sizeof(T); + assert(Head && Head->Buf); + + size_t P = (size_t)Head->Buf + Head->Used; + uintptr_t AlignedP = + (((size_t)P + alignof(T) - 1) & ~(size_t)(alignof(T) - 1)); + uint8_t *PP = (uint8_t *)AlignedP; + size_t Adjustment = AlignedP - P; + + Head->Used += Size + Adjustment; + if (Head->Used <= Head->Capacity) + return new (PP) T(std::forward(ConstructorArgs)...); + + static_assert(Size < AllocUnit, ""); + addNode(AllocUnit); + Head->Used = Size; + return new (Head->Buf) T(std::forward(ConstructorArgs)...); + } + +private: + AllocatorNode *Head = nullptr; +}; + +struct BackrefContext { + static constexpr size_t Max = 10; + + TypeNode *FunctionParams[Max]; + size_t FunctionParamCount = 0; + + // The first 10 BackReferences in a mangled name can be back-referenced by + // special name @[0-9]. This is a storage for the first 10 BackReferences. + NamedIdentifierNode *Names[Max]; + size_t NamesCount = 0; +}; + +enum class QualifierMangleMode { Drop, Mangle, Result }; + +enum NameBackrefBehavior : uint8_t { + NBB_None = 0, // don't save any names as backrefs. + NBB_Template = 1 << 0, // save template instanations. + NBB_Simple = 1 << 1, // save simple names. +}; + +enum class FunctionIdentifierCodeGroup { Basic, Under, DoubleUnder }; + +// Demangler class takes the main role in demangling symbols. +// It has a set of functions to parse mangled symbols into Type instances. +// It also has a set of functions to convert Type instances to strings. +class Demangler { +public: + Demangler() = default; + virtual ~Demangler() = default; + + // You are supposed to call parse() first and then check if error is true. If + // it is false, call output() to write the formatted name to the given stream. + SymbolNode *parse(StringView &MangledName); + + TagTypeNode *parseTagUniqueName(StringView &MangledName); + + // True if an error occurred. + bool Error = false; + + void dumpBackReferences(); + +private: + SymbolNode *demangleEncodedSymbol(StringView &MangledName, + QualifiedNameNode *QN); + SymbolNode *demangleDeclarator(StringView &MangledName); + SymbolNode *demangleMD5Name(StringView &MangledName); + + VariableSymbolNode *demangleVariableEncoding(StringView &MangledName, + StorageClass SC); + FunctionSymbolNode *demangleFunctionEncoding(StringView &MangledName); + + Qualifiers demanglePointerExtQualifiers(StringView &MangledName); + + // Parser functions. This is a recursive-descent parser. + TypeNode *demangleType(StringView &MangledName, QualifierMangleMode QMM); + PrimitiveTypeNode *demanglePrimitiveType(StringView &MangledName); + CustomTypeNode *demangleCustomType(StringView &MangledName); + TagTypeNode *demangleClassType(StringView &MangledName); + PointerTypeNode *demanglePointerType(StringView &MangledName); + PointerTypeNode *demangleMemberPointerType(StringView &MangledName); + FunctionSignatureNode *demangleFunctionType(StringView &MangledName, + bool HasThisQuals); + + ArrayTypeNode *demangleArrayType(StringView &MangledName); + + NodeArrayNode *demangleFunctionParameterList(StringView &MangledName, + bool &IsVariadic); + NodeArrayNode *demangleTemplateParameterList(StringView &MangledName); + + std::pair demangleNumber(StringView &MangledName); + uint64_t demangleUnsigned(StringView &MangledName); + int64_t demangleSigned(StringView &MangledName); + + void memorizeString(StringView s); + void memorizeIdentifier(IdentifierNode *Identifier); + + /// Allocate a copy of \p Borrowed into memory that we own. + StringView copyString(StringView Borrowed); + + QualifiedNameNode *demangleFullyQualifiedTypeName(StringView &MangledName); + QualifiedNameNode *demangleFullyQualifiedSymbolName(StringView &MangledName); + + IdentifierNode *demangleUnqualifiedTypeName(StringView &MangledName, + bool Memorize); + IdentifierNode *demangleUnqualifiedSymbolName(StringView &MangledName, + NameBackrefBehavior NBB); + + QualifiedNameNode *demangleNameScopeChain(StringView &MangledName, + IdentifierNode *UnqualifiedName); + IdentifierNode *demangleNameScopePiece(StringView &MangledName); + + NamedIdentifierNode *demangleBackRefName(StringView &MangledName); + IdentifierNode *demangleTemplateInstantiationName(StringView &MangledName, + NameBackrefBehavior NBB); + IntrinsicFunctionKind + translateIntrinsicFunctionCode(char CH, FunctionIdentifierCodeGroup Group); + IdentifierNode *demangleFunctionIdentifierCode(StringView &MangledName); + IdentifierNode * + demangleFunctionIdentifierCode(StringView &MangledName, + FunctionIdentifierCodeGroup Group); + StructorIdentifierNode *demangleStructorIdentifier(StringView &MangledName, + bool IsDestructor); + ConversionOperatorIdentifierNode * + demangleConversionOperatorIdentifier(StringView &MangledName); + LiteralOperatorIdentifierNode * + demangleLiteralOperatorIdentifier(StringView &MangledName); + + SymbolNode *demangleSpecialIntrinsic(StringView &MangledName); + SpecialTableSymbolNode * + demangleSpecialTableSymbolNode(StringView &MangledName, + SpecialIntrinsicKind SIK); + LocalStaticGuardVariableNode * + demangleLocalStaticGuard(StringView &MangledName, bool IsThread); + VariableSymbolNode *demangleUntypedVariable(ArenaAllocator &Arena, + StringView &MangledName, + StringView VariableName); + VariableSymbolNode * + demangleRttiBaseClassDescriptorNode(ArenaAllocator &Arena, + StringView &MangledName); + FunctionSymbolNode *demangleInitFiniStub(StringView &MangledName, + bool IsDestructor); + + NamedIdentifierNode *demangleSimpleName(StringView &MangledName, + bool Memorize); + NamedIdentifierNode *demangleAnonymousNamespaceName(StringView &MangledName); + NamedIdentifierNode *demangleLocallyScopedNamePiece(StringView &MangledName); + EncodedStringLiteralNode *demangleStringLiteral(StringView &MangledName); + FunctionSymbolNode *demangleVcallThunkNode(StringView &MangledName); + + StringView demangleSimpleString(StringView &MangledName, bool Memorize); + + FuncClass demangleFunctionClass(StringView &MangledName); + CallingConv demangleCallingConvention(StringView &MangledName); + StorageClass demangleVariableStorageClass(StringView &MangledName); + bool demangleThrowSpecification(StringView &MangledName); + wchar_t demangleWcharLiteral(StringView &MangledName); + uint8_t demangleCharLiteral(StringView &MangledName); + + std::pair demangleQualifiers(StringView &MangledName); + + // Memory allocator. + ArenaAllocator Arena; + + // A single type uses one global back-ref table for all function params. + // This means back-refs can even go "into" other types. Examples: + // + // // Second int* is a back-ref to first. + // void foo(int *, int*); + // + // // Second int* is not a back-ref to first (first is not a function param). + // int* foo(int*); + // + // // Second int* is a back-ref to first (ALL function types share the same + // // back-ref map. + // using F = void(*)(int*); + // F G(int *); + BackrefContext Backrefs; +}; + +} // namespace ms_demangle +} // namespace llvm + +#endif // LLVM_DEMANGLE_MICROSOFT_DEMANGLE_H diff --git a/patches/llvm90-headers/RTDyldObjectLinkingLayer.h b/patches/llvm90-headers/RTDyldObjectLinkingLayer.h new file mode 100644 index 000000000..4c688c3da --- /dev/null +++ b/patches/llvm90-headers/RTDyldObjectLinkingLayer.h @@ -0,0 +1,484 @@ +//===- RTDyldObjectLinkingLayer.h - RTDyld-based jit linking ---*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Contains the definition for an RTDyld-based, in-process object linking layer. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_EXECUTIONENGINE_ORC_RTDYLDOBJECTLINKINGLAYER_H +#define LLVM_EXECUTIONENGINE_ORC_RTDYLDOBJECTLINKINGLAYER_H + +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ExecutionEngine/JITSymbol.h" +#include "llvm/ExecutionEngine/Orc/Core.h" +#include "llvm/ExecutionEngine/Orc/Layer.h" +#include "llvm/ExecutionEngine/Orc/Legacy.h" +#include "llvm/ExecutionEngine/RuntimeDyld.h" +#include "llvm/Object/ObjectFile.h" +#include "llvm/Support/Error.h" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace llvm { +namespace orc { + +class RTDyldObjectLinkingLayer : public ObjectLayer { +public: + /// Functor for receiving object-loaded notifications. + using NotifyLoadedFunction = + std::function; + + /// Functor for receiving finalization notifications. + using NotifyEmittedFunction = + std::function)>; + + using GetMemoryManagerFunction = + std::function()>; + + /// Construct an ObjectLinkingLayer with the given NotifyLoaded, + /// and NotifyEmitted functors. + RTDyldObjectLinkingLayer(ExecutionSession &ES, + GetMemoryManagerFunction GetMemoryManager); + + /// Emit the object. + void emit(MaterializationResponsibility R, + std::unique_ptr O) override; + + /// Set the NotifyLoaded callback. + RTDyldObjectLinkingLayer &setNotifyLoaded(NotifyLoadedFunction NotifyLoaded) { + this->NotifyLoaded = std::move(NotifyLoaded); + return *this; + } + + /// Set the NotifyEmitted callback. + RTDyldObjectLinkingLayer & + setNotifyEmitted(NotifyEmittedFunction NotifyEmitted) { + this->NotifyEmitted = std::move(NotifyEmitted); + return *this; + } + + /// Set the 'ProcessAllSections' flag. + /// + /// If set to true, all sections in each object file will be allocated using + /// the memory manager, rather than just the sections required for execution. + /// + /// This is kludgy, and may be removed in the future. + RTDyldObjectLinkingLayer &setProcessAllSections(bool ProcessAllSections) { + this->ProcessAllSections = ProcessAllSections; + return *this; + } + + /// Instructs this RTDyldLinkingLayer2 instance to override the symbol flags + /// returned by RuntimeDyld for any given object file with the flags supplied + /// by the MaterializationResponsibility instance. This is a workaround to + /// support symbol visibility in COFF, which does not use the libObject's + /// SF_Exported flag. Use only when generating / adding COFF object files. + /// + /// FIXME: We should be able to remove this if/when COFF properly tracks + /// exported symbols. + RTDyldObjectLinkingLayer & + setOverrideObjectFlagsWithResponsibilityFlags(bool OverrideObjectFlags) { + this->OverrideObjectFlags = OverrideObjectFlags; + return *this; + } + + /// If set, this RTDyldObjectLinkingLayer instance will claim responsibility + /// for any symbols provided by a given object file that were not already in + /// the MaterializationResponsibility instance. Setting this flag allows + /// higher-level program representations (e.g. LLVM IR) to be added based on + /// only a subset of the symbols they provide, without having to write + /// intervening layers to scan and add the additional symbols. This trades + /// diagnostic quality for convenience however: If all symbols are enumerated + /// up-front then clashes can be detected and reported early (and usually + /// deterministically). If this option is set, clashes for the additional + /// symbols may not be detected until late, and detection may depend on + /// the flow of control through JIT'd code. Use with care. + RTDyldObjectLinkingLayer & + setAutoClaimResponsibilityForObjectSymbols(bool AutoClaimObjectSymbols) { + this->AutoClaimObjectSymbols = AutoClaimObjectSymbols; + return *this; + } + +private: + Error onObjLoad(VModuleKey K, MaterializationResponsibility &R, + object::ObjectFile &Obj, + std::unique_ptr LoadedObjInfo, + std::map Resolved, + std::set &InternalSymbols); + + void onObjEmit(VModuleKey K, std::unique_ptr ObjBuffer, + MaterializationResponsibility &R, Error Err); + + mutable std::mutex RTDyldLayerMutex; + GetMemoryManagerFunction GetMemoryManager; + NotifyLoadedFunction NotifyLoaded; + NotifyEmittedFunction NotifyEmitted; + bool ProcessAllSections = false; + bool OverrideObjectFlags = false; + bool AutoClaimObjectSymbols = false; + std::vector> MemMgrs; +}; + +class LegacyRTDyldObjectLinkingLayerBase { +public: + using ObjectPtr = std::unique_ptr; + +protected: + + /// Holds an object to be allocated/linked as a unit in the JIT. + /// + /// An instance of this class will be created for each object added + /// via JITObjectLayer::addObject. Deleting the instance (via + /// removeObject) frees its memory, removing all symbol definitions that + /// had been provided by this instance. Higher level layers are responsible + /// for taking any action required to handle the missing symbols. + class LinkedObject { + public: + LinkedObject() = default; + LinkedObject(const LinkedObject&) = delete; + void operator=(const LinkedObject&) = delete; + virtual ~LinkedObject() = default; + + virtual Error finalize() = 0; + + virtual JITSymbol::GetAddressFtor + getSymbolMaterializer(std::string Name) = 0; + + virtual void mapSectionAddress(const void *LocalAddress, + JITTargetAddress TargetAddr) const = 0; + + JITSymbol getSymbol(StringRef Name, bool ExportedSymbolsOnly) { + auto SymEntry = SymbolTable.find(Name); + if (SymEntry == SymbolTable.end()) + return nullptr; + if (!SymEntry->second.getFlags().isExported() && ExportedSymbolsOnly) + return nullptr; + if (!Finalized) + return JITSymbol(getSymbolMaterializer(Name), + SymEntry->second.getFlags()); + return JITSymbol(SymEntry->second); + } + + protected: + StringMap SymbolTable; + bool Finalized = false; + }; +}; + +/// Bare bones object linking layer. +/// +/// This class is intended to be used as the base layer for a JIT. It allows +/// object files to be loaded into memory, linked, and the addresses of their +/// symbols queried. All objects added to this layer can see each other's +/// symbols. +class LegacyRTDyldObjectLinkingLayer : public LegacyRTDyldObjectLinkingLayerBase { +public: + + using LegacyRTDyldObjectLinkingLayerBase::ObjectPtr; + + /// Functor for receiving object-loaded notifications. + using NotifyLoadedFtor = + std::function; + + /// Functor for receiving finalization notifications. + using NotifyFinalizedFtor = + std::function; + + /// Functor for receiving deallocation notifications. + using NotifyFreedFtor = std::function; + +private: + using OwnedObject = object::OwningBinary; + + template + class ConcreteLinkedObject : public LinkedObject { + public: + ConcreteLinkedObject(LegacyRTDyldObjectLinkingLayer &Parent, VModuleKey K, + OwnedObject Obj, MemoryManagerPtrT MemMgr, + std::shared_ptr Resolver, + bool ProcessAllSections) + : K(std::move(K)), + Parent(Parent), + MemMgr(std::move(MemMgr)), + PFC(llvm::make_unique( + std::move(Obj), std::move(Resolver), + ProcessAllSections)) { + buildInitialSymbolTable(PFC->Obj); + } + + ~ConcreteLinkedObject() override { + if (this->Parent.NotifyFreed && ObjForNotify.getBinary()) + this->Parent.NotifyFreed(K, *ObjForNotify.getBinary()); + + MemMgr->deregisterEHFrames(); + } + + Error finalize() override { + assert(PFC && "mapSectionAddress called on finalized LinkedObject"); + + JITSymbolResolverAdapter ResolverAdapter(Parent.ES, *PFC->Resolver, + nullptr); + PFC->RTDyld = llvm::make_unique(*MemMgr, ResolverAdapter); + PFC->RTDyld->setProcessAllSections(PFC->ProcessAllSections); + + Finalized = true; + + std::unique_ptr Info = + PFC->RTDyld->loadObject(*PFC->Obj.getBinary()); + + // Copy the symbol table out of the RuntimeDyld instance. + { + auto SymTab = PFC->RTDyld->getSymbolTable(); + for (auto &KV : SymTab) + SymbolTable[KV.first] = KV.second; + } + + if (Parent.NotifyLoaded) + Parent.NotifyLoaded(K, *PFC->Obj.getBinary(), *Info); + + PFC->RTDyld->finalizeWithMemoryManagerLocking(); + + if (PFC->RTDyld->hasError()) + return make_error(PFC->RTDyld->getErrorString(), + inconvertibleErrorCode()); + + if (Parent.NotifyFinalized) + Parent.NotifyFinalized(K, *PFC->Obj.getBinary(), *Info); + + // Release resources. + if (this->Parent.NotifyFreed) + ObjForNotify = std::move(PFC->Obj); // needed for callback + PFC = nullptr; + return Error::success(); + } + + JITSymbol::GetAddressFtor getSymbolMaterializer(std::string Name) override { + return [this, Name]() -> Expected { + // The symbol may be materialized between the creation of this lambda + // and its execution, so we need to double check. + if (!this->Finalized) + if (auto Err = this->finalize()) + return std::move(Err); + return this->getSymbol(Name, false).getAddress(); + }; + } + + void mapSectionAddress(const void *LocalAddress, + JITTargetAddress TargetAddr) const override { + assert(PFC && "mapSectionAddress called on finalized LinkedObject"); + assert(PFC->RTDyld && "mapSectionAddress called on raw LinkedObject"); + PFC->RTDyld->mapSectionAddress(LocalAddress, TargetAddr); + } + + private: + void buildInitialSymbolTable(const OwnedObject &Obj) { + for (auto &Symbol : Obj.getBinary()->symbols()) { + if (Symbol.getFlags() & object::SymbolRef::SF_Undefined) + continue; + Expected SymbolName = Symbol.getName(); + // FIXME: Raise an error for bad symbols. + if (!SymbolName) { + consumeError(SymbolName.takeError()); + continue; + } + // FIXME: Raise an error for bad symbols. + auto Flags = JITSymbolFlags::fromObjectSymbol(Symbol); + if (!Flags) { + consumeError(Flags.takeError()); + continue; + } + SymbolTable.insert( + std::make_pair(*SymbolName, JITEvaluatedSymbol(0, *Flags))); + } + } + + // Contains the information needed prior to finalization: the object files, + // memory manager, resolver, and flags needed for RuntimeDyld. + struct PreFinalizeContents { + PreFinalizeContents(OwnedObject Obj, + std::shared_ptr Resolver, + bool ProcessAllSections) + : Obj(std::move(Obj)), + Resolver(std::move(Resolver)), + ProcessAllSections(ProcessAllSections) {} + + OwnedObject Obj; + std::shared_ptr Resolver; + bool ProcessAllSections; + std::unique_ptr RTDyld; + }; + + VModuleKey K; + LegacyRTDyldObjectLinkingLayer &Parent; + MemoryManagerPtrT MemMgr; + OwnedObject ObjForNotify; + std::unique_ptr PFC; + }; + + template + std::unique_ptr> + createLinkedObject(LegacyRTDyldObjectLinkingLayer &Parent, VModuleKey K, + OwnedObject Obj, MemoryManagerPtrT MemMgr, + std::shared_ptr Resolver, + bool ProcessAllSections) { + using LOS = ConcreteLinkedObject; + return llvm::make_unique(Parent, std::move(K), std::move(Obj), + std::move(MemMgr), std::move(Resolver), + ProcessAllSections); + } + +public: + struct Resources { + std::shared_ptr MemMgr; + std::shared_ptr Resolver; + }; + + using ResourcesGetter = std::function; + + /// Construct an ObjectLinkingLayer with the given NotifyLoaded, + /// and NotifyFinalized functors. + LLVM_ATTRIBUTE_DEPRECATED( + LegacyRTDyldObjectLinkingLayer( + ExecutionSession &ES, ResourcesGetter GetResources, + NotifyLoadedFtor NotifyLoaded = NotifyLoadedFtor(), + NotifyFinalizedFtor NotifyFinalized = NotifyFinalizedFtor(), + NotifyFreedFtor NotifyFreed = NotifyFreedFtor()), + "ORCv1 layers (layers with the 'Legacy' prefix) are deprecated. Please " + "use " + "ORCv2 (see docs/ORCv2.rst)"); + + // Legacy layer constructor with deprecation acknowledgement. + LegacyRTDyldObjectLinkingLayer( + ORCv1DeprecationAcknowledgement, ExecutionSession &ES, + ResourcesGetter GetResources, + NotifyLoadedFtor NotifyLoaded = NotifyLoadedFtor(), + NotifyFinalizedFtor NotifyFinalized = NotifyFinalizedFtor(), + NotifyFreedFtor NotifyFreed = NotifyFreedFtor()) + : ES(ES), GetResources(std::move(GetResources)), + NotifyLoaded(std::move(NotifyLoaded)), + NotifyFinalized(std::move(NotifyFinalized)), + NotifyFreed(std::move(NotifyFreed)), ProcessAllSections(false) {} + + /// Set the 'ProcessAllSections' flag. + /// + /// If set to true, all sections in each object file will be allocated using + /// the memory manager, rather than just the sections required for execution. + /// + /// This is kludgy, and may be removed in the future. + void setProcessAllSections(bool ProcessAllSections) { + this->ProcessAllSections = ProcessAllSections; + } + + /// Add an object to the JIT. + Error addObject(VModuleKey K, ObjectPtr ObjBuffer) { + + auto Obj = + object::ObjectFile::createObjectFile(ObjBuffer->getMemBufferRef()); + if (!Obj) + return Obj.takeError(); + + assert(!LinkedObjects.count(K) && "VModuleKey already in use"); + + auto R = GetResources(K); + + LinkedObjects[K] = createLinkedObject( + *this, K, OwnedObject(std::move(*Obj), std::move(ObjBuffer)), + std::move(R.MemMgr), std::move(R.Resolver), ProcessAllSections); + + return Error::success(); + } + + /// Remove the object associated with VModuleKey K. + /// + /// All memory allocated for the object will be freed, and the sections and + /// symbols it provided will no longer be available. No attempt is made to + /// re-emit the missing symbols, and any use of these symbols (directly or + /// indirectly) will result in undefined behavior. If dependence tracking is + /// required to detect or resolve such issues it should be added at a higher + /// layer. + Error removeObject(VModuleKey K) { + assert(LinkedObjects.count(K) && "VModuleKey not associated with object"); + // How do we invalidate the symbols in H? + LinkedObjects.erase(K); + return Error::success(); + } + + /// Search for the given named symbol. + /// @param Name The name of the symbol to search for. + /// @param ExportedSymbolsOnly If true, search only for exported symbols. + /// @return A handle for the given named symbol, if it exists. + JITSymbol findSymbol(StringRef Name, bool ExportedSymbolsOnly) { + for (auto &KV : LinkedObjects) + if (auto Sym = KV.second->getSymbol(Name, ExportedSymbolsOnly)) + return Sym; + else if (auto Err = Sym.takeError()) + return std::move(Err); + + return nullptr; + } + + /// Search for the given named symbol in the context of the loaded + /// object represented by the VModuleKey K. + /// @param K The VModuleKey for the object to search in. + /// @param Name The name of the symbol to search for. + /// @param ExportedSymbolsOnly If true, search only for exported symbols. + /// @return A handle for the given named symbol, if it is found in the + /// given object. + JITSymbol findSymbolIn(VModuleKey K, StringRef Name, + bool ExportedSymbolsOnly) { + assert(LinkedObjects.count(K) && "VModuleKey not associated with object"); + return LinkedObjects[K]->getSymbol(Name, ExportedSymbolsOnly); + } + + /// Map section addresses for the object associated with the + /// VModuleKey K. + void mapSectionAddress(VModuleKey K, const void *LocalAddress, + JITTargetAddress TargetAddr) { + assert(LinkedObjects.count(K) && "VModuleKey not associated with object"); + LinkedObjects[K]->mapSectionAddress(LocalAddress, TargetAddr); + } + + /// Immediately emit and finalize the object represented by the given + /// VModuleKey. + /// @param K VModuleKey for object to emit/finalize. + Error emitAndFinalize(VModuleKey K) { + assert(LinkedObjects.count(K) && "VModuleKey not associated with object"); + return LinkedObjects[K]->finalize(); + } + +private: + ExecutionSession &ES; + + ResourcesGetter GetResources; + NotifyLoadedFtor NotifyLoaded; + NotifyFinalizedFtor NotifyFinalized; + NotifyFreedFtor NotifyFreed; + + // NB! `LinkedObjects` needs to be destroyed before `NotifyFreed` because + // `~ConcreteLinkedObject` calls `NotifyFreed` +protected: + std::map> LinkedObjects; +private: + bool ProcessAllSections = false; +}; + +} // end namespace orc +} // end namespace llvm + +#endif // LLVM_EXECUTIONENGINE_ORC_RTDYLDOBJECTLINKINGLAYER_H diff --git a/patches/llvm90/Add-missing-includes.diff b/patches/llvm90/Add-missing-includes.diff deleted file mode 100644 index f9dda0545..000000000 --- a/patches/llvm90/Add-missing-includes.diff +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/include/llvm/Demangle/MicrosoftDemangleNodes.h b/include/llvm/Demangle/MicrosoftDemangleNodes.h -index da9d9d5bfdc..3d47471f0ef 100644 ---- a/include/llvm/Demangle/MicrosoftDemangleNodes.h -+++ b/include/llvm/Demangle/MicrosoftDemangleNodes.h -@@ -16,6 +16,8 @@ - #include "llvm/Demangle/DemangleConfig.h" - #include "llvm/Demangle/StringView.h" - #include -+#include -+#include - - namespace llvm { - namespace itanium_demangle { diff --git a/patches/llvm90/Fix-the-compilation.diff b/patches/llvm90/Fix-the-compilation.diff deleted file mode 100644 index 07daa65c5..000000000 --- a/patches/llvm90/Fix-the-compilation.diff +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h b/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h -index 16202d89f86..3afdac3438b 100644 ---- a/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h -+++ b/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h -@@ -220,7 +220,7 @@ public: - Error removeModule(VModuleKey K) { - auto I = ModuleMap.find(K); - assert(I != ModuleMap.end() && "VModuleKey K not valid here"); -- auto EDM = std::move(I.second); -+ auto EDM = std::move(I->second); - ModuleMap.erase(I); - return EDM->removeModuleFromBaseLayer(BaseLayer); - } diff --git a/patches/llvm90/Make-datamember-protected.diff b/patches/llvm90/Make-datamember-protected.diff deleted file mode 100644 index b4fd64fa9..000000000 --- a/patches/llvm90/Make-datamember-protected.diff +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h b/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h -index d9535ce5f21..4c688c3da84 100644 ---- a/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h -+++ b/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h -@@ -472,7 +472,9 @@ private: - - // NB! `LinkedObjects` needs to be destroyed before `NotifyFreed` because - // `~ConcreteLinkedObject` calls `NotifyFreed` -+protected: - std::map> LinkedObjects; -+private: - bool ProcessAllSections = false; - }; - diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 1522f0d4f..a0372aef4 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -245,6 +245,8 @@ def download_llvm_binary(): os.path.join(llvm_dir, 'lib'), os.path.join(llvm_dir, 'include'), os.path.join(llvm_dir, 'bin', 'llvm-tblgen'), os.path.join(llvm_dir, 'bin')) else: + # Only while we use LLVM 9 + raise Exception("Building clang using LLVM binary not possible. Please invoke cpt without --with-binary-llvm and --with-llvm-tar flags") tar_required = True elif DIST == 'MacOSX': subprocess.call( @@ -259,9 +261,15 @@ def download_llvm_binary(): -DLLVM_TOOLS_BINARY_DIR={5} -DLLVM_TOOL_CLING_BUILD=ON".format(llvm_dir, llvm_config_path, os.path.join(llvm_dir, 'lib'), os.path.join(llvm_dir, 'include'), os.path.join(llvm_dir, 'bin', 'llvm-tblgen'), os.path.join(llvm_dir, 'bin')) + else: + # Only while we use LLVM 9 + raise Exception("Building clang using LLVM binary not possible. Please invoke cpt without --with-binary-llvm and --with-llvm-tar flags") + tar_required = True else: raise Exception("Building clang using LLVM binary not possible. Please invoke cpt without --with-binary-llvm and --with-llvm-tar flags") if tar_required: + # Only while we use LLVM 9 + raise Exception("--with-llvm-tar flag not supported currently") llvm_flags = "-DLLVM_BINARY_DIR={0} -DLLVM_CONFIG={1} -DLLVM_LIBRARY_DIR={2} -DLLVM_MAIN_INCLUDE_DIR={3} -DLLVM_TABLEGEN_EXE={4} \ -DLLVM_TOOLS_BINARY_DIR={5} -DLLVM_TOOL_CLING_BUILD=ON".format(srcdir, os.path.join(srcdir, 'bin', 'llvm-config'), os.path.join(srcdir, 'lib'), os.path.join(srcdir, 'include'), os.path.join(srcdir, 'bin', 'llvm-tblgen'), @@ -422,9 +430,6 @@ def update_old_cling(): else: get_fresh_cling() - # Only till we need the LLVM 9 patches - if tar_required: - apply_llvm_patches() def set_version(): global VERSION @@ -511,26 +516,6 @@ def allow_clang_tool(): with open(os.path.join(workdir, 'clang', 'tools', 'CMakeLists.txt'), 'a') as file: file.writelines('add_llvm_external_project(cling)') - -# Only for LLVM 9 -def apply_llvm_patches(): - assert llvm_revision == "release_90" - # Get llvm path - llvm_dir = exec_subprocess_check_output("llvm-config --src-root", ".").strip() - if llvm_dir == "": - if tar_required: - llvm_dir = copy.copy(srcdir) - else: - llvm_dir = os.path.join("/usr", "lib", "llvm-" + llvm_vers, "build") - # Move patches to correct location - for f in os.listdir(os.path.join(CLING_SRC_DIR, "patches", "llvm90")): - if f.endswith(".diff"): - shutil.move(os.path.join(CLING_SRC_DIR, "patches", "llvm90", f), llvm_dir) - # Apply patches - for f in os.listdir(llvm_dir): - if f.endswith(".diff"): - subprocess.run("patch -p1 < {0}".format(f), cwd=llvm_dir, shell=True) - class Build(object): def __init__(self, target=None): if args.get('create_dev_env'): @@ -629,10 +614,12 @@ def compile_for_binary(arg): print("Creating build directory: " + LLVM_OBJ_ROOT) os.makedirs(LLVM_OBJ_ROOT) + patch_path = os.path.join(CLING_SRC_DIR, "patches", "llvm90-headers") build = Build() cmake_config_flags = (clangdir + ' -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} ' .format(build.buildType, TMP_PREFIX) + llvm_flags + ' -DLLVM_TARGETS_TO_BUILD=host;NVPTX -DCLING_CXX_HEADERS=ON -DCLING_INCLUDE_TESTS=ON' + + ' -DCMAKE_CXX_FLAGS=-isystem {0} -DCMAKE_C_FLAGS=-isystem {0}'.format(patch_path) + EXTRA_CMAKE_FLAGS) box_draw('Configure Cling with CMake ' + cmake_config_flags) exec_subprocess_call('%s %s' % (CMAKE, cmake_config_flags), LLVM_OBJ_ROOT, True) @@ -1840,8 +1827,8 @@ def make_dmg(): parser.add_argument('--cling-branch', help='Specify a particular Cling branch') parser.add_argument('--with-binary-llvm', help='Download LLVM binary and use it to build Cling in dev mode', action='store_true') -# FIXME: Marked as inactive till we want to build using system installed LLVM -parser.add_argument('--with-llvm-tar', help='[INACTIVE] Download and use LLVM binary release tar to build Cling for debugging', action='store_true') +# Inactive till we want to build using system installed LLVM +# parser.add_argument('--with-llvm-tar', help='[INACTIVE] Download and use LLVM binary release tar to build Cling for debugging', action='store_true') parser.add_argument('--no-test', help='Do not run test suite of Cling', action='store_true') parser.add_argument('--skip-cleanup', help='Do not clean up after a build', action='store_true') parser.add_argument('--use-wget', help='Do not use Git to fetch sources', action='store_true') @@ -2013,8 +2000,7 @@ def custom_input(prompt, always_yes=False): else: LLVM_GIT_URL = "http://root.cern.ch/git/llvm.git" -# FIXME: Remove with_binary_llvm check when we want to build using system installed LLVM -if args['with_llvm_tar'] or args["with_binary_llvm"]: +if args['with_llvm_tar']: tar_required = True if args['check_requirements']: @@ -2025,12 +2011,9 @@ def custom_input(prompt, always_yes=False): prerequisite = ['git', 'cmake', 'gcc', 'g++', 'debhelper', 'devscripts', 'gnupg', 'zlib1g-dev'] if args["with_binary_llvm"] or args["with_llvm_tar"]: prerequisite.extend(['subversion']) - # FIXME: Uncomment when we want to build using system installed LLVM - ''' if args["with_binary_llvm"] and not args["with_llvm_tar"]: if check_ubuntu('llvm-'+llvm_vers+'-dev') is False: llvm_binary_name = 'llvm-{0}-dev'.format(llvm_vers) - ''' for pkg in prerequisite: if check_ubuntu(pkg) is False: install_line += pkg + ' ' @@ -2075,6 +2058,8 @@ def custom_input(prompt, always_yes=False): stdout=None, stderr=subprocess.STDOUT).communicate('yes'.encode('utf-8')) except: + # Only while we use LLVM 9 + raise Exception("--with-llvm-tar flag currently not supported") tar_required = True elif OS == 'Windows': From ef3ac2e6b17ed066bddc30ab8de9f04ea1416faa Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 19 Mar 2021 21:26:54 +0530 Subject: [PATCH 04/36] x --- tools/packaging/cpt.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index a0372aef4..54e245b22 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -619,7 +619,7 @@ def compile_for_binary(arg): cmake_config_flags = (clangdir + ' -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} ' .format(build.buildType, TMP_PREFIX) + llvm_flags + ' -DLLVM_TARGETS_TO_BUILD=host;NVPTX -DCLING_CXX_HEADERS=ON -DCLING_INCLUDE_TESTS=ON' + - ' -DCMAKE_CXX_FLAGS=-isystem {0} -DCMAKE_C_FLAGS=-isystem {0}'.format(patch_path) + + ' -DCMAKE_CXX_FLAGS="-isystem {0}" -DCMAKE_C_FLAGS="-isystem {0}"'.format(patch_path) + EXTRA_CMAKE_FLAGS) box_draw('Configure Cling with CMake ' + cmake_config_flags) exec_subprocess_call('%s %s' % (CMAKE, cmake_config_flags), LLVM_OBJ_ROOT, True) @@ -915,13 +915,6 @@ def check_ubuntu(pkg): else: print(pkg.ljust(20) + '[NOT INSTALLED]'.ljust(30)) return False - elif pkg == 'llvm-'+llvm_vers+'-dev': - if exec_subprocess_check_output('which llvm-config-{0}'.format(llvm_vers), workdir) != '': - print(pkg.ljust(20) + '[OK]'.ljust(30)) - return True - else: - print(pkg.ljust(20) + '[NOT INSTALLED]'.ljust(30)) - return False elif exec_subprocess_check_output("dpkg-query -W -f='${Status}' %s 2>/dev/null | grep -c 'ok installed'" % (pkg), '/').strip() == '0': print(pkg.ljust(20) + '[NOT INSTALLED]'.ljust(30)) @@ -1828,7 +1821,7 @@ def make_dmg(): parser.add_argument('--with-binary-llvm', help='Download LLVM binary and use it to build Cling in dev mode', action='store_true') # Inactive till we want to build using system installed LLVM -# parser.add_argument('--with-llvm-tar', help='[INACTIVE] Download and use LLVM binary release tar to build Cling for debugging', action='store_true') +parser.add_argument('--with-llvm-tar', help='[INACTIVE] Download and use LLVM binary release tar to build Cling for debugging', action='store_true') parser.add_argument('--no-test', help='Do not run test suite of Cling', action='store_true') parser.add_argument('--skip-cleanup', help='Do not clean up after a build', action='store_true') parser.add_argument('--use-wget', help='Do not use Git to fetch sources', action='store_true') @@ -2009,11 +2002,8 @@ def custom_input(prompt, always_yes=False): if DIST == 'Ubuntu': install_line = "" prerequisite = ['git', 'cmake', 'gcc', 'g++', 'debhelper', 'devscripts', 'gnupg', 'zlib1g-dev'] - if args["with_binary_llvm"] or args["with_llvm_tar"]: - prerequisite.extend(['subversion']) if args["with_binary_llvm"] and not args["with_llvm_tar"]: - if check_ubuntu('llvm-'+llvm_vers+'-dev') is False: - llvm_binary_name = 'llvm-{0}-dev'.format(llvm_vers) + llvm_binary_name = 'llvm-{0}-dev'.format(llvm_vers) for pkg in prerequisite: if check_ubuntu(pkg) is False: install_line += pkg + ' ' From 970d8b081d85932bd8e2b58acba1e9c90398daee Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Wed, 24 Mar 2021 11:53:56 +0530 Subject: [PATCH 05/36] x --- patches/llvm90-headers/type_traits.h | 212 +++++++++++++++++++++++++++ tools/packaging/cpt.py | 2 +- 2 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 patches/llvm90-headers/type_traits.h diff --git a/patches/llvm90-headers/type_traits.h b/patches/llvm90-headers/type_traits.h new file mode 100644 index 000000000..04e60f4b4 --- /dev/null +++ b/patches/llvm90-headers/type_traits.h @@ -0,0 +1,212 @@ +//===- llvm/Support/type_traits.h - Simplfied type traits -------*- C++ -*-===// +// +// 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 provides useful additions to the standard type_traits library. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_TYPE_TRAITS_H +#define LLVM_SUPPORT_TYPE_TRAITS_H + +#include "llvm/Support/Compiler.h" +#include +#include + +#ifndef __has_feature +#define LLVM_DEFINED_HAS_FEATURE +#define __has_feature(x) 0 +#endif + +namespace llvm { + + +/// Metafunction that determines whether the given type is either an +/// integral type or an enumeration type, including enum classes. +/// +/// Note that this accepts potentially more integral types than is_integral +/// because it is based on being implicitly convertible to an integral type. +/// Also note that enum classes aren't implicitly convertible to integral types, +/// the value may therefore need to be explicitly converted before being used. +template class is_integral_or_enum { + using UnderlyingT = typename std::remove_reference::type; + +public: + static const bool value = + !std::is_class::value && // Filter conversion operators. + !std::is_pointer::value && + !std::is_floating_point::value && + (std::is_enum::value || + std::is_convertible::value); +}; + +/// If T is a pointer, just return it. If it is not, return T&. +template +struct add_lvalue_reference_if_not_pointer { using type = T &; }; + +template +struct add_lvalue_reference_if_not_pointer< + T, typename std::enable_if::value>::type> { + using type = T; +}; + +/// If T is a pointer to X, return a pointer to const X. If it is not, +/// return const T. +template +struct add_const_past_pointer { using type = const T; }; + +template +struct add_const_past_pointer< + T, typename std::enable_if::value>::type> { + using type = const typename std::remove_pointer::type *; +}; + +template +struct const_pointer_or_const_ref { + using type = const T &; +}; +template +struct const_pointer_or_const_ref< + T, typename std::enable_if::value>::type> { + using type = typename add_const_past_pointer::type; +}; + +namespace detail { +/// Internal utility to detect trivial copy construction. +template union copy_construction_triviality_helper { + T t; + copy_construction_triviality_helper() = default; + copy_construction_triviality_helper(const copy_construction_triviality_helper&) = default; + ~copy_construction_triviality_helper() = default; +}; +/// Internal utility to detect trivial move construction. +template union move_construction_triviality_helper { + T t; + move_construction_triviality_helper() = default; + move_construction_triviality_helper(move_construction_triviality_helper&&) = default; + ~move_construction_triviality_helper() = default; +}; + +template +union trivial_helper { + T t; +}; + +} // end namespace detail + +/// An implementation of `std::is_trivially_copy_constructible` since we have +/// users with STLs that don't yet include it. +template +struct is_trivially_copy_constructible + : std::is_copy_constructible< + ::llvm::detail::copy_construction_triviality_helper> {}; +template +struct is_trivially_copy_constructible : std::true_type {}; +template +struct is_trivially_copy_constructible : std::false_type {}; + +/// An implementation of `std::is_trivially_move_constructible` since we have +/// users with STLs that don't yet include it. +template +struct is_trivially_move_constructible + : std::is_move_constructible< + ::llvm::detail::move_construction_triviality_helper> {}; +template +struct is_trivially_move_constructible : std::true_type {}; +template +struct is_trivially_move_constructible : std::true_type {}; + + +template +struct is_copy_assignable { + template + static auto get(F*) -> decltype(std::declval() = std::declval(), std::true_type{}); + static std::false_type get(...); + static constexpr bool value = decltype(get((T*)nullptr))::value; +}; + +template +struct is_move_assignable { + template + static auto get(F*) -> decltype(std::declval() = std::declval(), std::true_type{}); + static std::false_type get(...); + static constexpr bool value = decltype(get((T*)nullptr))::value; +}; + + +// An implementation of `std::is_trivially_copyable` since STL version +// is not equally supported by all compilers, especially GCC 4.9. +// Uniform implementation of this trait is important for ABI compatibility +// as it has an impact on SmallVector's ABI (among others). +template +class is_trivially_copyable { + + // copy constructors + static constexpr bool has_trivial_copy_constructor = + std::is_copy_constructible>::value; + static constexpr bool has_deleted_copy_constructor = + !std::is_copy_constructible::value; + + // move constructors + static constexpr bool has_trivial_move_constructor = + std::is_move_constructible>::value; + static constexpr bool has_deleted_move_constructor = + !std::is_move_constructible::value; + + // copy assign + static constexpr bool has_trivial_copy_assign = + is_copy_assignable>::value; + static constexpr bool has_deleted_copy_assign = + !is_copy_assignable::value; + + // move assign + static constexpr bool has_trivial_move_assign = + is_move_assignable>::value; + static constexpr bool has_deleted_move_assign = + !is_move_assignable::value; + + // destructor + static constexpr bool has_trivial_destructor = + std::is_destructible>::value; + + public: + + static constexpr bool value = + has_trivial_destructor && + (has_deleted_move_assign || has_trivial_move_assign) && + (has_deleted_move_constructor || has_trivial_move_constructor) && + (has_deleted_copy_assign || has_trivial_copy_assign) && + (has_deleted_copy_constructor || has_trivial_copy_constructor); + +#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE +#ifndef _MSC_VER + static_assert(value == std::is_trivially_copyable::value, + "inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable"); +#endif +#endif +}; +template +class is_trivially_copyable : public std::true_type { +}; + + +} // end namespace llvm + +// If the compiler supports detecting whether a class is final, define +// an LLVM_IS_FINAL macro. If it cannot be defined properly, this +// macro will be left undefined. +#if __cplusplus >= 201402L || defined(_MSC_VER) +#define LLVM_IS_FINAL(Ty) std::is_final() +#elif __has_feature(is_final) || LLVM_GNUC_PREREQ(4, 7, 0) +#define LLVM_IS_FINAL(Ty) __is_final(Ty) +#endif + +#ifdef LLVM_DEFINED_HAS_FEATURE +#undef __has_feature +#endif + +#endif // LLVM_SUPPORT_TYPE_TRAITS_H diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 54e245b22..f58959e28 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -2042,7 +2042,7 @@ def custom_input(prompt, always_yes=False): continue if no_install is False and llvm_binary_name != "" and tar_required is False: try: - subprocess.Popen(['sudo apt-get install llvm-{0}-dev'.format(llvm_vers)], + subprocess.Popen(['sudo apt-get install llvm-{0}-dev libclang-common-{0}-dev'.format(llvm_vers)], shell=True, stdin=subprocess.PIPE, stdout=None, From deaaac6fb577b44a4805a1f69765ec84568e0a78 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Wed, 24 Mar 2021 12:54:58 +0530 Subject: [PATCH 06/36] Fix macOS binary build --- tools/packaging/cpt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index f58959e28..a1859ec59 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -253,7 +253,7 @@ def download_llvm_binary(): "sudo -H {0} -m pip install lit".format(sys.executable), shell=True ) if tar_required is False: - llvm_dir = os.path.join("/opt", "local", "libexec", "llvm-"+llvm_vers) + llvm_dir = os.path.join("/opt", "local", "libexec", "llvm-"+llvm_vers+".0") llvm_config_path = os.path.join(llvm_dir, "bin", "llvm-config") if llvm_config_path[-1:] == "\n": llvm_config_path = llvm_config_path[:-1] @@ -502,7 +502,7 @@ def set_vars_for_lit(): with open(os.path.join(CLING_SRC_DIR, "test", "lit.site.cfg.in"), "w") as file: file.writelines(lines) elif DIST == 'MacOSX' and tar_required is False: - llvm_dir = os.path.join("/opt", "local", "libexec", "llvm-" + llvm_vers) + llvm_dir = os.path.join("/opt", "local", "libexec", "llvm-" + llvm_vers + ".0") with open(os.path.join(CLING_SRC_DIR, "test", "lit.site.cfg.in"), "r") as file: lines = file.readlines() for i in range(len(lines)): @@ -2098,7 +2098,7 @@ def custom_input(prompt, always_yes=False): if args['with_llvm_tar']: tar_required = True else: - llvm_binary_name = 'llvm-' + llvm_vers + llvm_binary_name = 'llvm-' + llvm_vers + ".0" for pkg in prerequisite: if check_mac(pkg) is False: install_line += pkg + ' ' From 18def66c6a2cdcce8f260b2a9472f4d268715615 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Wed, 24 Mar 2021 15:48:42 +0530 Subject: [PATCH 07/36] Reorganize LLVM 9 header patches and verbose make --- .github/workflows/ci.yml | 6 +++--- .../llvm90-headers/{ => llvm/Demangle}/MicrosoftDemangle.h | 0 .../{ => llvm/ExecutionEngine/Orc}/LazyEmittingLayer.h | 0 .../ExecutionEngine/Orc}/RTDyldObjectLinkingLayer.h | 0 patches/llvm90-headers/{ => llvm/Support}/type_traits.h | 0 5 files changed, 3 insertions(+), 3 deletions(-) rename patches/llvm90-headers/{ => llvm/Demangle}/MicrosoftDemangle.h (100%) rename patches/llvm90-headers/{ => llvm/ExecutionEngine/Orc}/LazyEmittingLayer.h (100%) rename patches/llvm90-headers/{ => llvm/ExecutionEngine/Orc}/RTDyldObjectLinkingLayer.h (100%) rename patches/llvm90-headers/{ => llvm/Support}/type_traits.h (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cab2ca934..a6863aa52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,10 +96,10 @@ jobs: fi export CLING_BUILD_FLAGS="$CLING_BUILD_FLAGS -DCLANG_ENABLE_ARCMT=OFF -DCLANG_ENABLE_STATIC_ANALYZER=OFF -DLLVM_ENABLE_WARNINGS=OFF -DCLING_ENABLE_WARNINGS=ON" if [[ ${{ matrix.name }} == *"compile"* ]]; then - python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} + python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --verbose # elif [[ ${{ matrix.name }} == *"fromtar"* ]]; then - # python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --with-llvm-tar + # python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --with-llvm-tar --verbose else - python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm + python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --verbose fi working-directory: tools/packaging/ diff --git a/patches/llvm90-headers/MicrosoftDemangle.h b/patches/llvm90-headers/llvm/Demangle/MicrosoftDemangle.h similarity index 100% rename from patches/llvm90-headers/MicrosoftDemangle.h rename to patches/llvm90-headers/llvm/Demangle/MicrosoftDemangle.h diff --git a/patches/llvm90-headers/LazyEmittingLayer.h b/patches/llvm90-headers/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h similarity index 100% rename from patches/llvm90-headers/LazyEmittingLayer.h rename to patches/llvm90-headers/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h diff --git a/patches/llvm90-headers/RTDyldObjectLinkingLayer.h b/patches/llvm90-headers/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h similarity index 100% rename from patches/llvm90-headers/RTDyldObjectLinkingLayer.h rename to patches/llvm90-headers/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h diff --git a/patches/llvm90-headers/type_traits.h b/patches/llvm90-headers/llvm/Support/type_traits.h similarity index 100% rename from patches/llvm90-headers/type_traits.h rename to patches/llvm90-headers/llvm/Support/type_traits.h From 42e21640e6e3d93d52a9002447fcc8a0ddc075e6 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Wed, 24 Mar 2021 18:33:19 +0530 Subject: [PATCH 08/36] Verbosity --- tools/packaging/cpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index a1859ec59..2178c0451 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -616,7 +616,7 @@ def compile_for_binary(arg): patch_path = os.path.join(CLING_SRC_DIR, "patches", "llvm90-headers") build = Build() - cmake_config_flags = (clangdir + ' -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} ' + cmake_config_flags = (clangdir + ' -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' .format(build.buildType, TMP_PREFIX) + llvm_flags + ' -DLLVM_TARGETS_TO_BUILD=host;NVPTX -DCLING_CXX_HEADERS=ON -DCLING_INCLUDE_TESTS=ON' + ' -DCMAKE_CXX_FLAGS="-isystem {0}" -DCMAKE_C_FLAGS="-isystem {0}"'.format(patch_path) + From 6eedbe285f9941ff1843507f0b220b5abf5d7c46 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Wed, 24 Mar 2021 19:44:46 +0530 Subject: [PATCH 09/36] isystem should read patch header first --- tools/packaging/cpt.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 2178c0451..f90083999 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -616,10 +616,9 @@ def compile_for_binary(arg): patch_path = os.path.join(CLING_SRC_DIR, "patches", "llvm90-headers") build = Build() - cmake_config_flags = (clangdir + ' -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' - .format(build.buildType, TMP_PREFIX) + llvm_flags + + cmake_config_flags = (clangdir + ' -DCMAKE_CXX_FLAGS="-isystem {2}" -DCMAKE_C_FLAGS="-isystem {2}" -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' + .format(build.buildType, TMP_PREFIX, patch_path) + llvm_flags + ' -DLLVM_TARGETS_TO_BUILD=host;NVPTX -DCLING_CXX_HEADERS=ON -DCLING_INCLUDE_TESTS=ON' + - ' -DCMAKE_CXX_FLAGS="-isystem {0}" -DCMAKE_C_FLAGS="-isystem {0}"'.format(patch_path) + EXTRA_CMAKE_FLAGS) box_draw('Configure Cling with CMake ' + cmake_config_flags) exec_subprocess_call('%s %s' % (CMAKE, cmake_config_flags), LLVM_OBJ_ROOT, True) From f1397a0a99d8e415393df28c58ad9f744b13b51a Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Thu, 25 Mar 2021 15:17:20 +0530 Subject: [PATCH 10/36] x --- tools/packaging/cpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index f90083999..15cac01fb 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -616,7 +616,7 @@ def compile_for_binary(arg): patch_path = os.path.join(CLING_SRC_DIR, "patches", "llvm90-headers") build = Build() - cmake_config_flags = (clangdir + ' -DCMAKE_CXX_FLAGS="-isystem {2}" -DCMAKE_C_FLAGS="-isystem {2}" -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' + cmake_config_flags = (clangdir + ' -DCMAKE_CXX_FLAGS="-isystem {2} $CMAKE_CXX_FLAGS" -DCMAKE_C_FLAGS="-isystem {2} $CMAKE_C_FLAGS" -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' .format(build.buildType, TMP_PREFIX, patch_path) + llvm_flags + ' -DLLVM_TARGETS_TO_BUILD=host;NVPTX -DCLING_CXX_HEADERS=ON -DCLING_INCLUDE_TESTS=ON' + EXTRA_CMAKE_FLAGS) From c9ab9b38ba31fc7b96ef81f9bc55eda9d3eeab20 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Thu, 25 Mar 2021 15:46:25 +0530 Subject: [PATCH 11/36] x --- tools/packaging/cpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 15cac01fb..e67f52fcc 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -616,7 +616,7 @@ def compile_for_binary(arg): patch_path = os.path.join(CLING_SRC_DIR, "patches", "llvm90-headers") build = Build() - cmake_config_flags = (clangdir + ' -DCMAKE_CXX_FLAGS="-isystem {2} $CMAKE_CXX_FLAGS" -DCMAKE_C_FLAGS="-isystem {2} $CMAKE_C_FLAGS" -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' + cmake_config_flags = (clangdir + ' -DCMAKE_CXX_FLAGS="-isystem {2} $CMAKE_CXX_FLAGS" -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' .format(build.buildType, TMP_PREFIX, patch_path) + llvm_flags + ' -DLLVM_TARGETS_TO_BUILD=host;NVPTX -DCLING_CXX_HEADERS=ON -DCLING_INCLUDE_TESTS=ON' + EXTRA_CMAKE_FLAGS) From 28dadc8b8dbd33210ff017a6853cd395f660897a Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Thu, 25 Mar 2021 16:15:17 +0530 Subject: [PATCH 12/36] x --- tools/packaging/cpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index e67f52fcc..c1734269f 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -616,7 +616,7 @@ def compile_for_binary(arg): patch_path = os.path.join(CLING_SRC_DIR, "patches", "llvm90-headers") build = Build() - cmake_config_flags = (clangdir + ' -DCMAKE_CXX_FLAGS="-isystem {2} $CMAKE_CXX_FLAGS" -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' + cmake_config_flags = (clangdir + ' -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS -isystem {2}" -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' .format(build.buildType, TMP_PREFIX, patch_path) + llvm_flags + ' -DLLVM_TARGETS_TO_BUILD=host;NVPTX -DCLING_CXX_HEADERS=ON -DCLING_INCLUDE_TESTS=ON' + EXTRA_CMAKE_FLAGS) From 078aad974fac7dd44385a22ba6ce96f46df971af Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Thu, 25 Mar 2021 16:17:38 +0530 Subject: [PATCH 13/36] X --- tools/packaging/cpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index c1734269f..6237a400e 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -616,7 +616,7 @@ def compile_for_binary(arg): patch_path = os.path.join(CLING_SRC_DIR, "patches", "llvm90-headers") build = Build() - cmake_config_flags = (clangdir + ' -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS -isystem {2}" -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' + cmake_config_flags = (clangdir + ' -DCMAKE_CXX_FLAGS="CMAKE_CXX_FLAGS -isystem {2}" -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' .format(build.buildType, TMP_PREFIX, patch_path) + llvm_flags + ' -DLLVM_TARGETS_TO_BUILD=host;NVPTX -DCLING_CXX_HEADERS=ON -DCLING_INCLUDE_TESTS=ON' + EXTRA_CMAKE_FLAGS) From 7caca9aadb27048c9e7e1c23af7c5d796bdef7a3 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 00:28:52 +0530 Subject: [PATCH 14/36] x --- CMakeLists.txt | 2 ++ tools/packaging/cpt.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 416a8a698..41dfa4676 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) endif() include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}") + # For LLVM 9 binary builds + include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm90-headers") link_directories("${LLVM_LIBRARY_DIR}") set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 6237a400e..d96e38d19 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -616,7 +616,7 @@ def compile_for_binary(arg): patch_path = os.path.join(CLING_SRC_DIR, "patches", "llvm90-headers") build = Build() - cmake_config_flags = (clangdir + ' -DCMAKE_CXX_FLAGS="CMAKE_CXX_FLAGS -isystem {2}" -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' + cmake_config_flags = (clangdir + '-DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' .format(build.buildType, TMP_PREFIX, patch_path) + llvm_flags + ' -DLLVM_TARGETS_TO_BUILD=host;NVPTX -DCLING_CXX_HEADERS=ON -DCLING_INCLUDE_TESTS=ON' + EXTRA_CMAKE_FLAGS) From 69c0fa0314740e7daade5f1c6399d80e8e8ddfb6 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 00:38:07 +0530 Subject: [PATCH 15/36] x --- tools/packaging/cpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index d96e38d19..c11f97ab8 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -616,7 +616,7 @@ def compile_for_binary(arg): patch_path = os.path.join(CLING_SRC_DIR, "patches", "llvm90-headers") build = Build() - cmake_config_flags = (clangdir + '-DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' + cmake_config_flags = (clangdir + ' -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' .format(build.buildType, TMP_PREFIX, patch_path) + llvm_flags + ' -DLLVM_TARGETS_TO_BUILD=host;NVPTX -DCLING_CXX_HEADERS=ON -DCLING_INCLUDE_TESTS=ON' + EXTRA_CMAKE_FLAGS) From 253f55400dc1a81cb6d02142666ad440c232c746 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 10:16:40 +0530 Subject: [PATCH 16/36] x --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41dfa4676..a651ad9ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,8 +102,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) endif() include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}") - # For LLVM 9 binary builds - include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm90-headers") link_directories("${LLVM_LIBRARY_DIR}") set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) @@ -348,6 +346,9 @@ macro(set_cling_windows_version_resource_properties name) endmacro() include_directories(BEFORE SYSTEM ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS}) +# For LLVM 9 binary builds +include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm90-headers") + macro(add_cling_library name) cmake_parse_arguments(ARG From 1233790c13a8eec6bd53e773e6c2add39aedd6e7 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 14:06:30 +0530 Subject: [PATCH 17/36] x --- .github/workflows/ci.yml | 4 ++++ tools/packaging/cpt.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6863aa52..215b51449 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,3 +103,7 @@ jobs: python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --verbose fi working-directory: tools/packaging/ + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + # timeout-minutes: 1 # When debugging increase to a suitable value! diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index c11f97ab8..90980b753 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -719,6 +719,7 @@ def runSingleTest(test, Idx = 2, Recurse = True): pass def setup_tests(): + ''' global tar_required llvm_revision = urlopen( "https://raw.githubusercontent.com/root-project/cling/master/LastKnownGoodLLVMSVNRevision.txt").readline().strip().decode( @@ -758,6 +759,7 @@ def setup_tests(): ).communicate("yes".encode("utf-8")) with open(os.path.join(CLING_SRC_DIR, 'tools', 'CMakeLists.txt'), 'a') as file: file.writelines('add_subdirectory(\"FileCheck\")') + ''' exec_subprocess_call("cmake {0}".format(LLVM_OBJ_ROOT), CLING_SRC_DIR) exec_subprocess_call("cmake --build . --target FileCheck -- -j{0}".format(multiprocessing.cpu_count()), LLVM_OBJ_ROOT) if not os.path.exists(os.path.join(CLING_SRC_DIR, "..", "clang", "test")) and os.path.exists(exec_subprocess_check_output("which lit").split()): From a6be43287bcbfd264f9aa3b49e0e2cac74dc0da3 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 14:37:57 +0530 Subject: [PATCH 18/36] x --- tools/packaging/cpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 90980b753..6ab068d02 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -759,9 +759,9 @@ def setup_tests(): ).communicate("yes".encode("utf-8")) with open(os.path.join(CLING_SRC_DIR, 'tools', 'CMakeLists.txt'), 'a') as file: file.writelines('add_subdirectory(\"FileCheck\")') - ''' exec_subprocess_call("cmake {0}".format(LLVM_OBJ_ROOT), CLING_SRC_DIR) exec_subprocess_call("cmake --build . --target FileCheck -- -j{0}".format(multiprocessing.cpu_count()), LLVM_OBJ_ROOT) + ''' if not os.path.exists(os.path.join(CLING_SRC_DIR, "..", "clang", "test")) and os.path.exists(exec_subprocess_check_output("which lit").split()): llvm_dir = exec_subprocess_check_output("llvm-config --src-root", ".").strip() if llvm_dir == "": From bc923eea831dcd1e4d06d380d3d54443c369785b Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 14:42:37 +0530 Subject: [PATCH 19/36] x --- tools/packaging/cpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 6ab068d02..2cb3707f8 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -719,7 +719,6 @@ def runSingleTest(test, Idx = 2, Recurse = True): pass def setup_tests(): - ''' global tar_required llvm_revision = urlopen( "https://raw.githubusercontent.com/root-project/cling/master/LastKnownGoodLLVMSVNRevision.txt").readline().strip().decode( @@ -749,6 +748,7 @@ def setup_tests(): stdout=None, stderr=subprocess.STDOUT, ).communicate("yes".encode("utf-8")) + ''' subprocess.Popen( ["sudo cp -r llvm-project-{0}/llvm/utils/FileCheck FileCheck".format(commit)], cwd=os.path.join(CLING_SRC_DIR, "tools"), From 8ee51215484617de851576529d2f42e1717943c8 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 15:38:18 +0530 Subject: [PATCH 20/36] Try without install_prefix --- tools/packaging/cpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 2cb3707f8..79728e1a3 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -2199,7 +2199,7 @@ def custom_input(prompt, always_yes=False): else: compile(os.path.join(workdir, 'cling-' + DIST + '-' + REV + '-' + platform.machine().lower() + '-' + VERSION)) - install_prefix() + #install_prefix() if not args['no_test']: if args['with_binary_llvm']: setup_tests() From 1f0adc34e39eb4c3f4bbefb1339f4792ad01564f Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 16:18:06 +0530 Subject: [PATCH 21/36] x --- tools/packaging/cpt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 79728e1a3..339a1f885 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -620,6 +620,10 @@ def compile_for_binary(arg): .format(build.buildType, TMP_PREFIX, patch_path) + llvm_flags + ' -DLLVM_TARGETS_TO_BUILD=host;NVPTX -DCLING_CXX_HEADERS=ON -DCLING_INCLUDE_TESTS=ON' + EXTRA_CMAKE_FLAGS) + + if os.path.exists(exec_subprocess_check_output("which lit", "/").strip()): + cmake_config_flags += "-DLLVM_EXTERNAL_LIT=" + exec_subprocess_check_output("which lit", "/").strip() + box_draw('Configure Cling with CMake ' + cmake_config_flags) exec_subprocess_call('%s %s' % (CMAKE, cmake_config_flags), LLVM_OBJ_ROOT, True) box_draw('Building %s (using %d cores)' % ("cling", multiprocessing.cpu_count())) @@ -762,7 +766,7 @@ def setup_tests(): exec_subprocess_call("cmake {0}".format(LLVM_OBJ_ROOT), CLING_SRC_DIR) exec_subprocess_call("cmake --build . --target FileCheck -- -j{0}".format(multiprocessing.cpu_count()), LLVM_OBJ_ROOT) ''' - if not os.path.exists(os.path.join(CLING_SRC_DIR, "..", "clang", "test")) and os.path.exists(exec_subprocess_check_output("which lit").split()): + if not os.path.exists(os.path.join(CLING_SRC_DIR, "..", "clang", "test")) and os.path.exists(exec_subprocess_check_output("which lit", "/").split()): llvm_dir = exec_subprocess_check_output("llvm-config --src-root", ".").strip() if llvm_dir == "": if tar_required: From 1a2aecb901045b05cf27fe223ccc63e409dc8689 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 17:11:02 +0530 Subject: [PATCH 22/36] x --- tools/packaging/cpt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 339a1f885..31ab11232 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -2205,8 +2205,8 @@ def custom_input(prompt, always_yes=False): 'cling-' + DIST + '-' + REV + '-' + platform.machine().lower() + '-' + VERSION)) #install_prefix() if not args['no_test']: - if args['with_binary_llvm']: - setup_tests() + #if args['with_binary_llvm']: + #setup_tests() test_cling() tarball() cleanup() From 7fdce6e5677d7f21bc85064f3814d5e9debebfcc Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 17:48:27 +0530 Subject: [PATCH 23/36] x --- tools/packaging/cpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 31ab11232..25dd8ac26 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -622,7 +622,7 @@ def compile_for_binary(arg): EXTRA_CMAKE_FLAGS) if os.path.exists(exec_subprocess_check_output("which lit", "/").strip()): - cmake_config_flags += "-DLLVM_EXTERNAL_LIT=" + exec_subprocess_check_output("which lit", "/").strip() + cmake_config_flags += " -DLLVM_EXTERNAL_LIT=" + exec_subprocess_check_output("which lit", "/").strip() box_draw('Configure Cling with CMake ' + cmake_config_flags) exec_subprocess_call('%s %s' % (CMAKE, cmake_config_flags), LLVM_OBJ_ROOT, True) From 8f190b27bbadfbbd678dabacf0d5fba533dbec73 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 18:27:18 +0530 Subject: [PATCH 24/36] Set python=python3 --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 215b51449..5afcbd3fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,6 +81,9 @@ jobs: if: runner.os == 'macOS' - name: Display compiler version run: $CC --version + - name: Set Python 3 as default + run: | + echo "python=python3" >> $GITHUB_ENV - name: Execute cpt run: | if [ ${{ github.event_name }} = 'pull_request' ]; then @@ -96,11 +99,11 @@ jobs: fi export CLING_BUILD_FLAGS="$CLING_BUILD_FLAGS -DCLANG_ENABLE_ARCMT=OFF -DCLANG_ENABLE_STATIC_ANALYZER=OFF -DLLVM_ENABLE_WARNINGS=OFF -DCLING_ENABLE_WARNINGS=ON" if [[ ${{ matrix.name }} == *"compile"* ]]; then - python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --verbose + python cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --verbose # elif [[ ${{ matrix.name }} == *"fromtar"* ]]; then - # python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --with-llvm-tar --verbose + # python cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --with-llvm-tar --verbose else - python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --verbose + python cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --verbose fi working-directory: tools/packaging/ - name: Setup tmate session From e8e34ff379424b5e6e9665a1d58a4ecf5a8910c2 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 18:39:19 +0530 Subject: [PATCH 25/36] x --- .github/workflows/ci.yml | 2 +- tools/packaging/cpt.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5afcbd3fe..d0d99de1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,7 @@ jobs: run: $CC --version - name: Set Python 3 as default run: | - echo "python=python3" >> $GITHUB_ENV + sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10 - name: Execute cpt run: | if [ ${{ github.event_name }} = 'pull_request' ]; then diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 25dd8ac26..bfbe56741 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -22,6 +22,7 @@ import sys +# FIXME: Check doesn't work? if sys.version_info < (3, 0): raise Exception("cpt needs Python 3") From ef6d9e87fe2318b92b093235c44fa3e883133b0b Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 19:27:55 +0530 Subject: [PATCH 26/36] x --- tools/packaging/cpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index bfbe56741..7ff5aa878 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -2204,7 +2204,7 @@ def custom_input(prompt, always_yes=False): else: compile(os.path.join(workdir, 'cling-' + DIST + '-' + REV + '-' + platform.machine().lower() + '-' + VERSION)) - #install_prefix() + install_prefix() if not args['no_test']: #if args['with_binary_llvm']: #setup_tests() From 38eb53c82088a595edde3fd23138baaeb73a68b0 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Fri, 26 Mar 2021 23:39:21 +0530 Subject: [PATCH 27/36] x --- tools/packaging/cpt.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 7ff5aa878..6ecdd7da8 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -753,7 +753,6 @@ def setup_tests(): stdout=None, stderr=subprocess.STDOUT, ).communicate("yes".encode("utf-8")) - ''' subprocess.Popen( ["sudo cp -r llvm-project-{0}/llvm/utils/FileCheck FileCheck".format(commit)], cwd=os.path.join(CLING_SRC_DIR, "tools"), @@ -766,7 +765,6 @@ def setup_tests(): file.writelines('add_subdirectory(\"FileCheck\")') exec_subprocess_call("cmake {0}".format(LLVM_OBJ_ROOT), CLING_SRC_DIR) exec_subprocess_call("cmake --build . --target FileCheck -- -j{0}".format(multiprocessing.cpu_count()), LLVM_OBJ_ROOT) - ''' if not os.path.exists(os.path.join(CLING_SRC_DIR, "..", "clang", "test")) and os.path.exists(exec_subprocess_check_output("which lit", "/").split()): llvm_dir = exec_subprocess_check_output("llvm-config --src-root", ".").strip() if llvm_dir == "": @@ -2206,8 +2204,8 @@ def custom_input(prompt, always_yes=False): 'cling-' + DIST + '-' + REV + '-' + platform.machine().lower() + '-' + VERSION)) install_prefix() if not args['no_test']: - #if args['with_binary_llvm']: - #setup_tests() + if args['with_binary_llvm'] and tar_required: + setup_tests() test_cling() tarball() cleanup() From 37c47398211575199139f24b9ce79b358e75f40d Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Sat, 27 Mar 2021 11:24:32 +0530 Subject: [PATCH 28/36] Set FileCheck name --- .../ForwardDeclareAllInIncludePaths.C | 2 +- test/CUDADeviceCode/CUDADefineArg.C | 2 +- test/CUDADeviceCode/CUDAHostPrefix.C | 2 +- test/CUDADeviceCode/CUDAKernelArgument.C | 2 +- test/CUDADeviceCode/CUDAKernelTemplateComplex.C | 2 +- test/CUDADeviceCode/CUDAKernelTemplateSimple.C | 2 +- test/CUDADeviceCode/CUDARegression.C | 2 +- test/CUDADeviceCode/CUDASharedMemory.C | 2 +- test/CUDADeviceCode/CUDASimpleKernel.C | 2 +- test/CUDADeviceCode/CUDAStreams.C | 2 +- test/CodeGeneration/CUDACtorDtor.C | 2 +- test/CodeGeneration/Inline.C | 2 +- test/CodeGeneration/Lambda.C | 2 +- test/CodeGeneration/RecursiveInit.C | 2 +- test/CodeGeneration/Statics.C | 2 +- test/CodeGeneration/Symbols.C | 2 +- test/CodeGeneration/VTables.C | 2 +- test/CodeUnloading/AtExit.C | 2 +- test/CodeUnloading/CGlobalDecl.C | 2 +- test/CodeUnloading/CircularReferences.C | 2 +- test/CodeUnloading/Classes.C | 2 +- test/CodeUnloading/DeclShadowing.C | 2 +- test/CodeUnloading/Dtors.C | 2 +- test/CodeUnloading/ExternC.C | 2 +- test/CodeUnloading/Macros.C | 2 +- test/CodeUnloading/PCH/Inlines.C | 2 +- test/CodeUnloading/PCH/VTables.C | 4 ++-- test/CodeUnloading/PCH/VTablesClingPCH.C | 2 +- test/CodeUnloading/RereadFile.C | 2 +- test/CodeUnloading/Simple.C | 2 +- test/Driver/C.c | 2 +- test/Driver/CUDAMode.C | 2 +- test/Driver/CurrentDir.C | 2 +- test/Driver/CurrentDirRm.C | 2 +- test/Driver/E.C | 2 +- test/Driver/EOF.C | 2 +- test/Driver/Gnu.C | 8 ++++---- test/Driver/Init.C | 2 +- test/Driver/Inputs.C | 2 +- test/Driver/NoRuntime.C | 2 +- test/Driver/Shebang.C | 2 +- test/Driver/XexternC.C | 2 +- test/Driver/args.C | 4 ++-- test/ErrorRecovery/ABI.C | 10 +++++----- test/ErrorRecovery/AnonymousDecls.C | 2 +- test/ErrorRecovery/CurrentFailures.C | 2 +- test/ErrorRecovery/Diagnostics.C | 2 +- test/ErrorRecovery/Lamda.C | 2 +- test/ErrorRecovery/MacroExpansion.C | 2 +- test/ErrorRecovery/MetaProcessor.C | 2 +- test/ErrorRecovery/NestedTags.C | 2 +- test/ErrorRecovery/Redeclarables.C | 2 +- test/ErrorRecovery/StoredState.C | 2 +- test/ErrorRecovery/SubsequentDecls.C | 2 +- test/ErrorRecovery/UnCacheFile.C | 2 +- test/Extensions/ImplicitAutoKeyword/Auto.C | 2 +- .../ImplicitAutoKeyword/AutoInitOrder.C | 2 +- test/Extensions/Lookup/Arrays.C | 2 +- test/Extensions/Lookup/ControlFlow.C | 2 +- test/Extensions/Lookup/LifetimeHandler.C | 2 +- test/Extensions/Lookup/SimpleDynamicExprs.C | 2 +- test/Extensions/Lookup/StillError.C | 2 +- test/Interfaces/Macro.C | 2 +- test/Interfaces/address.C | 2 +- test/Interfaces/compileFunc.C | 2 +- test/Interfaces/echo.C | 2 +- test/Interfaces/evaluate.C | 2 +- test/Interfaces/execute.C | 2 +- test/Interfaces/invocationFlags.C | 2 +- test/Interfaces/paths.C | 2 +- test/Interfaces/print.C | 2 +- test/Interfaces/transactionReuse.C | 2 +- test/LibraryCall/call.C | 2 +- test/LibraryCall/callable_lib.C | 2 +- test/Lookup/args.C | 2 +- test/Lookup/data.C | 2 +- test/Lookup/func.C | 2 +- test/Lookup/linkageSpec.C | 2 +- test/Lookup/named.C | 2 +- test/Lookup/scope.C | 2 +- test/Lookup/tag.C | 2 +- test/Lookup/template.C | 2 +- test/Lookup/type.C | 2 +- test/Lookup/variadicFunc.C | 2 +- test/MultipleInterpreters/MultipleInterpreters.C | 2 +- test/NullDeref/NonNullArg.C | 2 +- test/Plugins/Simple.C | 2 +- test/Pragmas/add_env_path.C | 2 +- test/Pragmas/load.C | 2 +- test/Pragmas/opt.C | 2 +- test/Prompt/BlockComments.C | 2 +- test/Prompt/Continuation.C | 2 +- test/Prompt/DontWrap.C | 2 +- test/Prompt/Exceptions.C | 2 +- test/Prompt/MetaProcessor/42.X-Non-Id-Chars.C | 2 +- test/Prompt/MetaProcessor/CustomMeta.C | 2 +- test/Prompt/MetaProcessor/DotO.C | 2 +- test/Prompt/MetaProcessor/InputValidator.C | 2 +- test/Prompt/MetaProcessor/Macros.C | 2 +- test/Prompt/MetaProcessor/Regression.C | 2 +- test/Prompt/MetaProcessor/Trace.C | 2 +- test/Prompt/OutputRedirect.C | 16 ++++++++-------- test/Prompt/PreprocessorIf.C | 2 +- test/Prompt/RawInput.C | 2 +- test/Prompt/RecursiveGlobalInits.C | 2 +- test/Prompt/Regression.C | 2 +- test/Prompt/ValuePrinter/Assignments.C | 2 +- test/Prompt/ValuePrinter/Collections.C | 2 +- test/Prompt/ValuePrinter/Destruction.C | 2 +- test/Prompt/ValuePrinter/Ptrs.C | 2 +- test/Prompt/ValuePrinter/Strings.C | 2 +- test/Prompt/ValuePrinter/Templates.C | 2 +- test/Prompt/cppmacros.C | 2 +- test/Prompt/cppmacros_remember.C | 2 +- test/Prompt/cppundef.C | 2 +- test/Prompt/decls.C | 2 +- test/Prompt/globalinit.C | 4 ++-- test/Prompt/globals.C | 2 +- test/Prompt/initorder.C | 2 +- test/Recursion/Exceptions.C | 2 +- test/Recursion/RecursiveClingInstances.C | 2 +- test/SourceCall/ErrorMacro.C | 2 +- test/SourceCall/decls.C | 2 +- test/SourceCall/test_01.c | 4 ++-- test/SourceCall/unresolved.C | 2 +- test/lit.cfg | 10 ++++++++++ 126 files changed, 153 insertions(+), 143 deletions(-) diff --git a/test/Autoloading/ForwardDeclareAllInIncludePaths.C b/test/Autoloading/ForwardDeclareAllInIncludePaths.C index 60efe7f3c..63642e77a 100644 --- a/test/Autoloading/ForwardDeclareAllInIncludePaths.C +++ b/test/Autoloading/ForwardDeclareAllInIncludePaths.C @@ -1,4 +1,4 @@ -//RUN: cat %s | %cling -Xclang -verify "-DCLING=\" %cling \"" | FileCheck %s +//RUN: cat %s | %cling -Xclang -verify "-DCLING=\" %cling \"" | %filecheck %s //RUN: %rm /tmp/__cling_fwd_* //XFAIL:* #include "cling/Interpreter/Interpreter.h" diff --git a/test/CUDADeviceCode/CUDADefineArg.C b/test/CUDADeviceCode/CUDADefineArg.C index dd82bdf78..b849ce4fb 100644 --- a/test/CUDADeviceCode/CUDADefineArg.C +++ b/test/CUDADeviceCode/CUDADefineArg.C @@ -9,7 +9,7 @@ // The Test checks whether a define argument (-DTEST=3) is passed to the PTX // compiler. If it works, it should not throw an error. -// RUN: cat %s | %cling -DTEST=3 -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -DTEST=3 -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | %filecheck %s // REQUIRES: cuda-runtime #include diff --git a/test/CUDADeviceCode/CUDAHostPrefix.C b/test/CUDADeviceCode/CUDAHostPrefix.C index 34e91bedf..0b025ede8 100644 --- a/test/CUDADeviceCode/CUDAHostPrefix.C +++ b/test/CUDADeviceCode/CUDAHostPrefix.C @@ -9,7 +9,7 @@ // The Test checks if a function with __host__ and __device__ prefix available // on host and device side. -// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | %filecheck %s // REQUIRES: cuda-runtime .rawInput 1 diff --git a/test/CUDADeviceCode/CUDAKernelArgument.C b/test/CUDADeviceCode/CUDAKernelArgument.C index dd924eaeb..932cd2c1a 100644 --- a/test/CUDADeviceCode/CUDAKernelArgument.C +++ b/test/CUDADeviceCode/CUDAKernelArgument.C @@ -9,7 +9,7 @@ // The Test checks if a CUDA kernel works with a arguments and built-in // functions. -// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | %filecheck %s // REQUIRES: cuda-runtime // Test, if a simple kernel with arguments works. diff --git a/test/CUDADeviceCode/CUDAKernelTemplateComplex.C b/test/CUDADeviceCode/CUDAKernelTemplateComplex.C index abd06d418..0de6ddd5b 100644 --- a/test/CUDADeviceCode/CUDAKernelTemplateComplex.C +++ b/test/CUDADeviceCode/CUDAKernelTemplateComplex.C @@ -8,7 +8,7 @@ //------------------------------------------------------------------------------ // The Test checks if templated CUDA kernel in some special cases works. -// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | %filecheck %s // REQUIRES: cuda-runtime // Check if templated CUDA kernel works, without explicit template type declaration. diff --git a/test/CUDADeviceCode/CUDAKernelTemplateSimple.C b/test/CUDADeviceCode/CUDAKernelTemplateSimple.C index 7feba809c..afa5df990 100644 --- a/test/CUDADeviceCode/CUDAKernelTemplateSimple.C +++ b/test/CUDADeviceCode/CUDAKernelTemplateSimple.C @@ -8,7 +8,7 @@ //------------------------------------------------------------------------------ // The Test checks if templated CUDA kernel works. -// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | %filecheck %s // REQUIRES: cuda-runtime // Check if template device side resoultion works. diff --git a/test/CUDADeviceCode/CUDARegression.C b/test/CUDADeviceCode/CUDARegression.C index dc9731fb4..752f25aba 100644 --- a/test/CUDADeviceCode/CUDARegression.C +++ b/test/CUDADeviceCode/CUDARegression.C @@ -9,7 +9,7 @@ // The test checks if the interface functions process(), declare() and parse() // of cling::Interpreter also work in the cuda mode. -// RUN: cat %s | %cling -DTEST_PATH="\"%/p/\"" -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -DTEST_PATH="\"%/p/\"" -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | %filecheck %s // REQUIRES: cuda-runtime #include "cling/Interpreter/Interpreter.h" diff --git a/test/CUDADeviceCode/CUDASharedMemory.C b/test/CUDADeviceCode/CUDASharedMemory.C index a3430299e..fe2d80b89 100644 --- a/test/CUDADeviceCode/CUDASharedMemory.C +++ b/test/CUDADeviceCode/CUDASharedMemory.C @@ -8,7 +8,7 @@ //------------------------------------------------------------------------------ // The Test checks if runtime shared memory works. -// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | %filecheck %s // REQUIRES: cuda-runtime const unsigned int numberOfThreads = 4; diff --git a/test/CUDADeviceCode/CUDASimpleKernel.C b/test/CUDADeviceCode/CUDASimpleKernel.C index 4fecaeb82..1d702a8e0 100644 --- a/test/CUDADeviceCode/CUDASimpleKernel.C +++ b/test/CUDADeviceCode/CUDASimpleKernel.C @@ -9,7 +9,7 @@ // The Test checks if a CUDA compatible device is available and checks, if simple // __global__ and __device__ kernels are running. -// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | %filecheck %s // REQUIRES: cuda-runtime // Check if cuda driver is available diff --git a/test/CUDADeviceCode/CUDAStreams.C b/test/CUDADeviceCode/CUDAStreams.C index 902c646fb..265925a6b 100644 --- a/test/CUDADeviceCode/CUDAStreams.C +++ b/test/CUDADeviceCode/CUDAStreams.C @@ -8,7 +8,7 @@ //------------------------------------------------------------------------------ // The Test checks if cuda streams works. -// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | %filecheck %s // REQUIRES: cuda-runtime const unsigned int numberOfThreads = 4; diff --git a/test/CodeGeneration/CUDACtorDtor.C b/test/CodeGeneration/CUDACtorDtor.C index f445e4ae9..bee8f73aa 100644 --- a/test/CodeGeneration/CUDACtorDtor.C +++ b/test/CodeGeneration/CUDACtorDtor.C @@ -9,7 +9,7 @@ // The Test checks, if the symbols __cuda_module_ctor and __cuda_module_dtor are // unique for every module. Attention, for a working test case, a cuda // fatbinary is necessary. -// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | %filecheck %s // REQUIRES: cuda-runtime #include "cling/Interpreter/Interpreter.h" diff --git a/test/CodeGeneration/Inline.C b/test/CodeGeneration/Inline.C index bc397be29..411a20628 100644 --- a/test/CodeGeneration/Inline.C +++ b/test/CodeGeneration/Inline.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN:cat %s | %cling -I %S -Xclang -verify 2>&1 | FileCheck -allow-empty %s +// RUN:cat %s | %cling -I %S -Xclang -verify 2>&1 | %filecheck -allow-empty %s // Test testInline // ROOT-8283 diff --git a/test/CodeGeneration/Lambda.C b/test/CodeGeneration/Lambda.C index 42f545293..f6faa78ae 100644 --- a/test/CodeGeneration/Lambda.C +++ b/test/CodeGeneration/Lambda.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling | FileCheck %s +// RUN: cat %s | %cling | %filecheck %s // Check that lambda mangling is stable across transactions (ROOT-10689) diff --git a/test/CodeGeneration/RecursiveInit.C b/test/CodeGeneration/RecursiveInit.C index 5979a6330..7d8686b28 100644 --- a/test/CodeGeneration/RecursiveInit.C +++ b/test/CodeGeneration/RecursiveInit.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: %cling %s | FileCheck %s +// RUN: %cling %s | %filecheck %s extern "C" int printf(const char*,...); #include "cling/Interpreter/Interpreter.h" diff --git a/test/CodeGeneration/Statics.C b/test/CodeGeneration/Statics.C index 67b0ad82d..d3d4019b8 100644 --- a/test/CodeGeneration/Statics.C +++ b/test/CodeGeneration/Statics.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s #include diff --git a/test/CodeGeneration/Symbols.C b/test/CodeGeneration/Symbols.C index 87f083ea3..383c6fc63 100644 --- a/test/CodeGeneration/Symbols.C +++ b/test/CodeGeneration/Symbols.C @@ -7,7 +7,7 @@ //------------------------------------------------------------------------------ // RUN: clang -shared %fPIC -DCLING_EXPORT=%dllexport -DBUILD_SHARED %s -o%T/libSymbols%shlibext -// RUN: %cling --nologo -L%T -lSymbols %s | FileCheck %s +// RUN: %cling --nologo -L%T -lSymbols %s | %filecheck %s // Check that weak symbols do not get re-emitted (ROOT-6124) extern "C" int printf(const char*,...); diff --git a/test/CodeGeneration/VTables.C b/test/CodeGeneration/VTables.C index c1705937d..d5c7fab3e 100644 --- a/test/CodeGeneration/VTables.C +++ b/test/CodeGeneration/VTables.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify | %filecheck %s // XFAIL:* // Test whether the interpreter is able to generate properly the symbols diff --git a/test/CodeUnloading/AtExit.C b/test/CodeUnloading/AtExit.C index cc391b166..977cfd2b7 100644 --- a/test/CodeUnloading/AtExit.C +++ b/test/CodeUnloading/AtExit.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s // FIXME: cat %s | %cling -fsyntax-only -Xclang -verify 2>&1 // Test to check functions registered via atexit are intercepted, and __dso_handle diff --git a/test/CodeUnloading/CGlobalDecl.C b/test/CodeUnloading/CGlobalDecl.C index 18ebd5aa0..08aebd672 100644 --- a/test/CodeUnloading/CGlobalDecl.C +++ b/test/CodeUnloading/CGlobalDecl.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%S -Xclang -verify | FileCheck %s +// RUN: cat %s | %cling -I%S -Xclang -verify | %filecheck %s // Test externC_GlobalDecl extern "C" int printf(const char*,...); diff --git a/test/CodeUnloading/CircularReferences.C b/test/CodeUnloading/CircularReferences.C index 94ae6e73b..d4c46ef87 100644 --- a/test/CodeUnloading/CircularReferences.C +++ b/test/CodeUnloading/CircularReferences.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s .storeState "preUnload" .rawInput 1 diff --git a/test/CodeUnloading/Classes.C b/test/CodeUnloading/Classes.C index 76afb20f3..f821f584e 100644 --- a/test/CodeUnloading/Classes.C +++ b/test/CodeUnloading/Classes.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s extern "C" int printf(const char* fmt, ...); .storeState "preUnload" diff --git a/test/CodeUnloading/DeclShadowing.C b/test/CodeUnloading/DeclShadowing.C index 39bb0376e..01b15e650 100644 --- a/test/CodeUnloading/DeclShadowing.C +++ b/test/CodeUnloading/DeclShadowing.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s #include #include #include diff --git a/test/CodeUnloading/Dtors.C b/test/CodeUnloading/Dtors.C index 325077c40..0fae37a78 100644 --- a/test/CodeUnloading/Dtors.C +++ b/test/CodeUnloading/Dtors.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s // XFAIL:* extern "C" int printf(const char* fmt, ...); // force emission of cxa_atexit such that it doesn't pollute the diff. diff --git a/test/CodeUnloading/ExternC.C b/test/CodeUnloading/ExternC.C index 07d026af7..3fa09b042 100644 --- a/test/CodeUnloading/ExternC.C +++ b/test/CodeUnloading/ExternC.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%S -Xclang -verify | FileCheck %s +// RUN: cat %s | %cling -I%S -Xclang -verify | %filecheck %s // Test externCUndo .storeState "A" diff --git a/test/CodeUnloading/Macros.C b/test/CodeUnloading/Macros.C index 250806e1e..3fafbcdcd 100644 --- a/test/CodeUnloading/Macros.C +++ b/test/CodeUnloading/Macros.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%S -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -I%S -Xclang -verify 2>&1 | %filecheck %s // Tests undoing of macro definitions // Invoke the printer to get it in the undo queue early diff --git a/test/CodeUnloading/PCH/Inlines.C b/test/CodeUnloading/PCH/Inlines.C index 3b272834f..f8a2dab19 100644 --- a/test/CodeUnloading/PCH/Inlines.C +++ b/test/CodeUnloading/PCH/Inlines.C @@ -1,6 +1,6 @@ // RUN: %rm "Inlines.h.pch" // RUN: %cling -x c++-header %S/Inputs/Inlines.h -o Inlines.h.pch -// RUN: cat %s | %cling -I%p -Xclang -trigraphs -Xclang -include-pch -Xclang Inlines.h.pch 2>&1 | FileCheck %s +// RUN: cat %s | %cling -I%p -Xclang -trigraphs -Xclang -include-pch -Xclang Inlines.h.pch 2>&1 | %filecheck %s //XFAIL:* #include "Inputs/Inlines.h" diff --git a/test/CodeUnloading/PCH/VTables.C b/test/CodeUnloading/PCH/VTables.C index d15264653..6f83e5ca0 100644 --- a/test/CodeUnloading/PCH/VTables.C +++ b/test/CodeUnloading/PCH/VTables.C @@ -2,8 +2,8 @@ // RUN: %rm "CompGen.h.pch" && %rm "%T/Rel/Path/Relative.pch" // RUN: clang -x c++-header -fexceptions -fcxx-exceptions -std=c++14 -pthread %S/Inputs/CompGen.h -o CompGen.h.pch // RUN: clang -x c++-header -fexceptions -fcxx-exceptions -std=c++14 -pthread %S/Inputs/CompGen.h -o %T/Rel/Path/Relative.pch -// RUN: cat %s | %cling -I%p -Xclang -include-pch -Xclang CompGen.h.pch 2>&1 | FileCheck %s -// RUN: cat %s | %cling -I%p -I%T/Rel/Path -include-pch Relative.pch 2>&1 | FileCheck %s +// RUN: cat %s | %cling -I%p -Xclang -include-pch -Xclang CompGen.h.pch 2>&1 | %filecheck %s +// RUN: cat %s | %cling -I%p -I%T/Rel/Path -include-pch Relative.pch 2>&1 | %filecheck %s //.storeState "a" .x TriggerCompGen.h diff --git a/test/CodeUnloading/PCH/VTablesClingPCH.C b/test/CodeUnloading/PCH/VTablesClingPCH.C index caef19da7..c3e18b520 100644 --- a/test/CodeUnloading/PCH/VTablesClingPCH.C +++ b/test/CodeUnloading/PCH/VTablesClingPCH.C @@ -1,6 +1,6 @@ // RUN: %rm "CompGen2.h.pch" // RUN: %cling -x c++-header %S/Inputs/CompGen.h -o CompGen2.h.pch -// RUN: cat %s | %cling -I%p -Xclang -include-pch -Xclang CompGen2.h.pch 2>&1 | FileCheck %s +// RUN: cat %s | %cling -I%p -Xclang -include-pch -Xclang CompGen2.h.pch 2>&1 | %filecheck %s //.storeState "a" .x TriggerCompGen.h diff --git a/test/CodeUnloading/RereadFile.C b/test/CodeUnloading/RereadFile.C index 352c73722..6f355dae8 100644 --- a/test/CodeUnloading/RereadFile.C +++ b/test/CodeUnloading/RereadFile.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p 2>&1 | FileCheck %s +// RUN: cat %s | %cling -I%p 2>&1 | %filecheck %s // Test that we re-read file, e.g. that we uncache symbols and file content. extern "C" int printf(const char*,...); diff --git a/test/CodeUnloading/Simple.C b/test/CodeUnloading/Simple.C index 62a5b7676..1bd006a92 100644 --- a/test/CodeUnloading/Simple.C +++ b/test/CodeUnloading/Simple.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s // Test the ability of unloading the last transaction. Here as a matter of fact // we unload the wrapper as well and TODO: decrement the unique wrapper counter. extern "C" int printf(const char* fmt, ...); diff --git a/test/Driver/C.c b/test/Driver/C.c index ee3029204..1a0d89f7a 100644 --- a/test/Driver/C.c +++ b/test/Driver/C.c @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -x c -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -x c -Xclang -verify 2>&1 | %filecheck %s // RUN: cat %s | %cling -x c -fsyntax-only -Xclang -verify 2>&1 // Validate cling C mode. diff --git a/test/Driver/CUDAMode.C b/test/Driver/CUDAMode.C index 3cc790c96..11f81b52e 100644 --- a/test/Driver/CUDAMode.C +++ b/test/Driver/CUDAMode.C @@ -9,7 +9,7 @@ // The Test starts the cling with the arg -xcuda and checks if the cuda mode // is enabled. -// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -Xclang -verify 2>&1 | %filecheck %s // RUN: cat %s | %cling -x cuda --cuda-path=%cudapath %cudasmlevel -fsyntax-only -Xclang -verify 2>&1 // REQUIRES: cuda-runtime diff --git a/test/Driver/CurrentDir.C b/test/Driver/CurrentDir.C index d2fe702bd..b6cb3eb58 100644 --- a/test/Driver/CurrentDir.C +++ b/test/Driver/CurrentDir.C @@ -8,7 +8,7 @@ // Test runing a file in the same directory `cling CurrentDir.C` // More info in CIFactory.cpp createCIImpl (line ~850) -// RUN: cd %S && %cling -Xclang -verify CurrentDir.C 2>&1 | FileCheck %s +// RUN: cd %S && %cling -Xclang -verify CurrentDir.C 2>&1 | %filecheck %s extern "C" { int printf(const char*, ...); diff --git a/test/Driver/CurrentDirRm.C b/test/Driver/CurrentDirRm.C index f66aed006..bc4d649a3 100644 --- a/test/Driver/CurrentDirRm.C +++ b/test/Driver/CurrentDirRm.C @@ -10,7 +10,7 @@ // RUN: %mkdir "%T/Remove" // RUN: cd "%T/Remove" // RUN: %rmdir "%T/Remove" -// RUN: %cling %s -Xclang -verify 2>&1 | FileCheck %s +// RUN: %cling %s -Xclang -verify 2>&1 | %filecheck %s // REQUIRES: not_system-windows extern "C" { diff --git a/test/Driver/E.C b/test/Driver/E.C index 4e8016294..58c03cc5a 100644 --- a/test/Driver/E.C +++ b/test/Driver/E.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: echo "" | %cling -dM -E -xc++ -std=c++11 | FileCheck %s +// RUN: echo "" | %cling -dM -E -xc++ -std=c++11 | %filecheck %s // CHECK: #define __CLING__ 1 // CHECK: #define __CLING__CXX11 1 diff --git a/test/Driver/EOF.C b/test/Driver/EOF.C index a8e0c35c1..05a6e199c 100644 --- a/test/Driver/EOF.C +++ b/test/Driver/EOF.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s // Test that input is not discarded if the last line has no newline. extern "C" int printf(const char*, ...); diff --git a/test/Driver/Gnu.C b/test/Driver/Gnu.C index 47c0c084a..cf92d03f5 100644 --- a/test/Driver/Gnu.C +++ b/test/Driver/Gnu.C @@ -6,10 +6,10 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -std=gnu99 -x c -Xclang -verify 2>&1 | FileCheck %s -// RUN: cat %s | %cling -D__STRICT_ANSI__ -std=gnu++11 -Xclang -verify 2>&1 | FileCheck %s -// RUN: cat %s | %cling -D__STRICT_ANSI__ -std=gnu++14 -Xclang -verify 2>&1 | FileCheck %s -// RUN: cat %s | %cling -D__STRICT_ANSI__ -std=gnu++1z -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -std=gnu99 -x c -Xclang -verify 2>&1 | %filecheck %s +// RUN: cat %s | %cling -D__STRICT_ANSI__ -std=gnu++11 -Xclang -verify 2>&1 | %filecheck %s +// RUN: cat %s | %cling -D__STRICT_ANSI__ -std=gnu++14 -Xclang -verify 2>&1 | %filecheck %s +// RUN: cat %s | %cling -D__STRICT_ANSI__ -std=gnu++1z -Xclang -verify 2>&1 | %filecheck %s // REQUIRES: not_system-windows #ifdef __cplusplus diff --git a/test/Driver/Init.C b/test/Driver/Init.C index 7460e8874..7cef66fb4 100644 --- a/test/Driver/Init.C +++ b/test/Driver/Init.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -//RUN: cat %s | %cling 2>&1 | FileCheck %s +//RUN: cat %s | %cling 2>&1 | %filecheck %s #include std::vector l {'a', 'b', '\''}; diff --git a/test/Driver/Inputs.C b/test/Driver/Inputs.C index 0f3671646..3eeee92f2 100644 --- a/test/Driver/Inputs.C +++ b/test/Driver/Inputs.C @@ -1,4 +1,4 @@ -//RUN: %cling "limits" "std::numeric_limits::is_signed" "int i = 0;" "i" | FileCheck %s +//RUN: %cling "limits" "std::numeric_limits::is_signed" "int i = 0;" "i" | %filecheck %s //CHECK: (const {{_B|b}}ool) true //CHECK: (int) 0 diff --git a/test/Driver/NoRuntime.C b/test/Driver/NoRuntime.C index c86317af1..f0154b9a8 100644 --- a/test/Driver/NoRuntime.C +++ b/test/Driver/NoRuntime.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -noruntime -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -noruntime -Xclang -verify 2>&1 | %filecheck %s // Test noruntimeTest extern "C" int printf(const char*,...); diff --git a/test/Driver/Shebang.C b/test/Driver/Shebang.C index c66168813..56ead4e8a 100644 --- a/test/Driver/Shebang.C +++ b/test/Driver/Shebang.C @@ -7,7 +7,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: %cling %s 2>&1 | FileCheck %s +// RUN: %cling %s 2>&1 | %filecheck %s //CHECK-NOT: {{.*error|warning|note:.*}} float shebang = 1.0 //CHECK: (float) 1 diff --git a/test/Driver/XexternC.C b/test/Driver/XexternC.C index 1aafe1865..073c584b1 100644 --- a/test/Driver/XexternC.C +++ b/test/Driver/XexternC.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: %cling %s | FileCheck %s +// RUN: %cling %s | %filecheck %s extern "C" int printf(const char*,...); diff --git a/test/Driver/args.C b/test/Driver/args.C index bd216142b..336344c08 100644 --- a/test/Driver/args.C +++ b/test/Driver/args.C @@ -6,8 +6,8 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -//RUN: %cling %s "args(42,\"AAA)BBB\")" 2>&1 | FileCheck %s -//RUN: %cling ".x %s(42,\"AAA)BBB\")" 2>&1 | FileCheck -check-prefix=CHECK-DOTX %s +//RUN: %cling %s "args(42,\"AAA)BBB\")" 2>&1 | %filecheck %s +//RUN: %cling ".x %s(42,\"AAA)BBB\")" 2>&1 | %filecheck -check-prefix=CHECK-DOTX %s // From .x-implicit args() call: //CHECK: input_line_4:2:2: error: no matching function for call to 'args' diff --git a/test/ErrorRecovery/ABI.C b/test/ErrorRecovery/ABI.C index 5f2baffc4..728fedc7c 100644 --- a/test/ErrorRecovery/ABI.C +++ b/test/ErrorRecovery/ABI.C @@ -6,11 +6,11 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: %cling -C -E -P %s | %cling -nostdinc++ -Xclang -verify 2>&1 | FileCheck %s -// RUN: %cling -C -E -P -DCLING_VALEXTRACT_ERR %s | %cling -nostdinc++ -nobuiltininc -Xclang -verify 2>&1 | FileCheck %s -// RUN: %cling -C -E -P -DCLING_VALEXTRACT_ERR2 %s | %cling -nostdinc++ -nobuiltininc -Xclang -verify 2>&1 | FileCheck %s -// RUN: %cling -C -E -P -DCLING_VALEXTRACT_ERR3 %s | %cling -nostdinc++ -nobuiltininc -Xclang -verify 2>&1 | FileCheck %s -// RUN: %cling -C -E -P -DCLING_VALEXTRACT_ERR4 %s | %cling -nostdinc++ -nobuiltininc -Xclang -verify 2>&1 | FileCheck %s +// RUN: %cling -C -E -P %s | %cling -nostdinc++ -Xclang -verify 2>&1 | %filecheck %s +// RUN: %cling -C -E -P -DCLING_VALEXTRACT_ERR %s | %cling -nostdinc++ -nobuiltininc -Xclang -verify 2>&1 | %filecheck %s +// RUN: %cling -C -E -P -DCLING_VALEXTRACT_ERR2 %s | %cling -nostdinc++ -nobuiltininc -Xclang -verify 2>&1 | %filecheck %s +// RUN: %cling -C -E -P -DCLING_VALEXTRACT_ERR3 %s | %cling -nostdinc++ -nobuiltininc -Xclang -verify 2>&1 | %filecheck %s +// RUN: %cling -C -E -P -DCLING_VALEXTRACT_ERR4 %s | %cling -nostdinc++ -nobuiltininc -Xclang -verify 2>&1 | %filecheck %s // expected-error@input_line_1:1 {{'new' file not found}} diff --git a/test/ErrorRecovery/AnonymousDecls.C b/test/ErrorRecovery/AnonymousDecls.C index 2ccf67b99..1c7fb7010 100644 --- a/test/ErrorRecovery/AnonymousDecls.C +++ b/test/ErrorRecovery/AnonymousDecls.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s // Actually test clang::DeclContext::removeDecl(). This function in clang is // the main method that is used for the error recovery. This means when there diff --git a/test/ErrorRecovery/CurrentFailures.C b/test/ErrorRecovery/CurrentFailures.C index e9b9285ec..38216c564 100644 --- a/test/ErrorRecovery/CurrentFailures.C +++ b/test/ErrorRecovery/CurrentFailures.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p 2>&1 | FileCheck %s +// RUN: cat %s | %cling -I%p 2>&1 | %filecheck %s // XFAIL: * .storeState "testCurrentFailures" diff --git a/test/ErrorRecovery/Diagnostics.C b/test/ErrorRecovery/Diagnostics.C index 8eecb6441..e6ff7a505 100644 --- a/test/ErrorRecovery/Diagnostics.C +++ b/test/ErrorRecovery/Diagnostics.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -fno-rtti -Xclang -verify 2>&1 | %filecheck %s // Test that user can override the DiagnosicsClient without error diff --git a/test/ErrorRecovery/Lamda.C b/test/ErrorRecovery/Lamda.C index 420c93f42..fd556a2be 100644 --- a/test/ErrorRecovery/Lamda.C +++ b/test/ErrorRecovery/Lamda.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s // This file should be used as regression test for the value printing subsystem // Reproducers of fixed bugs should be put here diff --git a/test/ErrorRecovery/MacroExpansion.C b/test/ErrorRecovery/MacroExpansion.C index d6410b574..ddad6826a 100644 --- a/test/ErrorRecovery/MacroExpansion.C +++ b/test/ErrorRecovery/MacroExpansion.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s #define BEGIN_NAMESPACE namespace test_namespace { #define END_NAMESPACE } diff --git a/test/ErrorRecovery/MetaProcessor.C b/test/ErrorRecovery/MetaProcessor.C index 09474b56d..75006601d 100644 --- a/test/ErrorRecovery/MetaProcessor.C +++ b/test/ErrorRecovery/MetaProcessor.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p 2>&1 | FileCheck %s +// RUN: cat %s | %cling -I%p 2>&1 | %filecheck %s // The main issue is that expected - error is not propagated to the source file and // the expected diagnostics get misplaced. diff --git a/test/ErrorRecovery/NestedTags.C b/test/ErrorRecovery/NestedTags.C index 92d3fa052..fd28489c4 100644 --- a/test/ErrorRecovery/NestedTags.C +++ b/test/ErrorRecovery/NestedTags.C @@ -14,7 +14,7 @@ FIX RUN LINE BELOW TO TURN THE TEST BACK ON!!! Currently, builtins cannot reliably ignored in the comparison of before and after, causing this test to sometimes fail. -// : cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// : cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s // Tests the removal of nested decls .storeState "testNestedDecls1" diff --git a/test/ErrorRecovery/Redeclarables.C b/test/ErrorRecovery/Redeclarables.C index d3128d1bb..633e213b8 100644 --- a/test/ErrorRecovery/Redeclarables.C +++ b/test/ErrorRecovery/Redeclarables.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -I%p -Xclang -verify 2>&1 | %filecheck %s // Test the removal of decls from the redeclaration chain, which are marked as // redeclarables. diff --git a/test/ErrorRecovery/StoredState.C b/test/ErrorRecovery/StoredState.C index ff786e030..3c1d0d38d 100644 --- a/test/ErrorRecovery/StoredState.C +++ b/test/ErrorRecovery/StoredState.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -v -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -v -Xclang -verify 2>&1 | %filecheck %s int i = 0; .storeState "A" diff --git a/test/ErrorRecovery/SubsequentDecls.C b/test/ErrorRecovery/SubsequentDecls.C index 15c3bb477..39cd01393 100644 --- a/test/ErrorRecovery/SubsequentDecls.C +++ b/test/ErrorRecovery/SubsequentDecls.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -I%p -Xclang -verify 2>&1 | %filecheck %s // Test the removal of decls which are stored in vector of redeclarables .rawInput 1 diff --git a/test/ErrorRecovery/UnCacheFile.C b/test/ErrorRecovery/UnCacheFile.C index 5db4c6d37..d52b61a01 100644 --- a/test/ErrorRecovery/UnCacheFile.C +++ b/test/ErrorRecovery/UnCacheFile.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s // XFAIL: * // Test the ability of including a wrong file see diagnostics and remove the diff --git a/test/Extensions/ImplicitAutoKeyword/Auto.C b/test/Extensions/ImplicitAutoKeyword/Auto.C index bf88e8d94..7772ddf06 100644 --- a/test/Extensions/ImplicitAutoKeyword/Auto.C +++ b/test/Extensions/ImplicitAutoKeyword/Auto.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling --enable-implicit-auto-keyword | FileCheck %s +// RUN: cat %s | %cling --enable-implicit-auto-keyword | %filecheck %s // XFAIL: * // ROOT-5324 diff --git a/test/Extensions/ImplicitAutoKeyword/AutoInitOrder.C b/test/Extensions/ImplicitAutoKeyword/AutoInitOrder.C index df44728dc..242466725 100644 --- a/test/Extensions/ImplicitAutoKeyword/AutoInitOrder.C +++ b/test/Extensions/ImplicitAutoKeyword/AutoInitOrder.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling --enable-implicit-auto-keyword | FileCheck %s +// RUN: cat %s | %cling --enable-implicit-auto-keyword | %filecheck %s // XFAIL: * class MyClass { diff --git a/test/Extensions/Lookup/Arrays.C b/test/Extensions/Lookup/Arrays.C index 096b515b5..36057104e 100644 --- a/test/Extensions/Lookup/Arrays.C +++ b/test/Extensions/Lookup/Arrays.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p | FileCheck %s +// RUN: cat %s | %cling -I%p | %filecheck %s #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/InterpreterCallbacks.h" diff --git a/test/Extensions/Lookup/ControlFlow.C b/test/Extensions/Lookup/ControlFlow.C index 4b4fc08c6..3d766dbe0 100644 --- a/test/Extensions/Lookup/ControlFlow.C +++ b/test/Extensions/Lookup/ControlFlow.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p | FileCheck %s +// RUN: cat %s | %cling -I%p | %filecheck %s // The tests shows the basic control flow structures that contain dynamic // expressions. There are several cases that could be distinguished. diff --git a/test/Extensions/Lookup/LifetimeHandler.C b/test/Extensions/Lookup/LifetimeHandler.C index e7f47f7ff..58ebd994a 100644 --- a/test/Extensions/Lookup/LifetimeHandler.C +++ b/test/Extensions/Lookup/LifetimeHandler.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p | FileCheck %s +// RUN: cat %s | %cling -I%p | %filecheck %s // We should revise the destruction of the LifetimeHandlers, because // its destructor uses gCling and the CompilerInstance, which are // already gone diff --git a/test/Extensions/Lookup/SimpleDynamicExprs.C b/test/Extensions/Lookup/SimpleDynamicExprs.C index 97a7ee503..597e5b783 100644 --- a/test/Extensions/Lookup/SimpleDynamicExprs.C +++ b/test/Extensions/Lookup/SimpleDynamicExprs.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p | FileCheck %s +// RUN: cat %s | %cling -I%p | %filecheck %s #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/InterpreterCallbacks.h" diff --git a/test/Extensions/Lookup/StillError.C b/test/Extensions/Lookup/StillError.C index b541a458c..fe93d4cc0 100644 --- a/test/Extensions/Lookup/StillError.C +++ b/test/Extensions/Lookup/StillError.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p 2>&1 | FileCheck %s +// RUN: cat %s | %cling -I%p 2>&1 | %filecheck %s // Test failures of dynamic lookups. diff --git a/test/Interfaces/Macro.C b/test/Interfaces/Macro.C index 36cbc89ee..adc9d20fb 100644 --- a/test/Interfaces/Macro.C +++ b/test/Interfaces/Macro.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s #include "cling/Interpreter/Interpreter.h" diff --git a/test/Interfaces/address.C b/test/Interfaces/address.C index b6c4322f5..851451e23 100644 --- a/test/Interfaces/address.C +++ b/test/Interfaces/address.C @@ -7,7 +7,7 @@ //------------------------------------------------------------------------------ // RUN: clang -shared -DCLING_EXPORT=%dllexport %S/address_lib.c -olibaddress_lib%shlibext -// RUN: cat %s | %cling -L. -fno-rtti | FileCheck %s +// RUN: cat %s | %cling -L. -fno-rtti | %filecheck %s extern "C" int printf(const char*,...); #include "cling/Interpreter/Interpreter.h" diff --git a/test/Interfaces/compileFunc.C b/test/Interfaces/compileFunc.C index d10c8b866..cdee5d5df 100644 --- a/test/Interfaces/compileFunc.C +++ b/test/Interfaces/compileFunc.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: %cling -Xclang -verify %s | FileCheck %s +// RUN: %cling -Xclang -verify %s | %filecheck %s extern "C" int printf(const char*,...); class Foo { diff --git a/test/Interfaces/echo.C b/test/Interfaces/echo.C index 266ccd536..3a366eed2 100644 --- a/test/Interfaces/echo.C +++ b/test/Interfaces/echo.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/Value.h" diff --git a/test/Interfaces/evaluate.C b/test/Interfaces/evaluate.C index cbec8ea80..f4a91f993 100644 --- a/test/Interfaces/evaluate.C +++ b/test/Interfaces/evaluate.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify | %filecheck %s #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/Value.h" diff --git a/test/Interfaces/execute.C b/test/Interfaces/execute.C index 78d883f4a..7b98d7aae 100644 --- a/test/Interfaces/execute.C +++ b/test/Interfaces/execute.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s #include "cling/Interpreter/Interpreter.h" diff --git a/test/Interfaces/invocationFlags.C b/test/Interfaces/invocationFlags.C index 3d3c3a2cd..99a13a454 100644 --- a/test/Interfaces/invocationFlags.C +++ b/test/Interfaces/invocationFlags.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s // Make sure we are correctly parsing the arguments for CIFactory::createCI #include "cling/Interpreter/InvocationOptions.h" diff --git a/test/Interfaces/paths.C b/test/Interfaces/paths.C index bf2746462..cb6977cdc 100644 --- a/test/Interfaces/paths.C +++ b/test/Interfaces/paths.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -DTEST_PATH="\"%/p/\"" -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -DTEST_PATH="\"%/p/\"" -Xclang -verify 2>&1 | %filecheck %s #include "cling/Interpreter/Interpreter.h" diff --git a/test/Interfaces/print.C b/test/Interfaces/print.C index ca53821e6..f4054ceba 100644 --- a/test/Interfaces/print.C +++ b/test/Interfaces/print.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s #include "cling/Interpreter/Interpreter.h" diff --git a/test/Interfaces/transactionReuse.C b/test/Interfaces/transactionReuse.C index a05ac3d93..cc068ad3c 100644 --- a/test/Interfaces/transactionReuse.C +++ b/test/Interfaces/transactionReuse.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti | FileCheck %s +// RUN: cat %s | %cling -fno-rtti | %filecheck %s // This test makes sure the interpreter doesn't create many useless empty // transactions. diff --git a/test/LibraryCall/call.C b/test/LibraryCall/call.C index c01442b50..caf8141b3 100644 --- a/test/LibraryCall/call.C +++ b/test/LibraryCall/call.C @@ -7,7 +7,7 @@ //------------------------------------------------------------------------------ // RUN: clang -shared -DCLING_EXPORT=%dllexport %S/call_lib.c -o%T/libcall_lib2%shlibext -// RUN: cat %s | %cling -L%T | FileCheck %s +// RUN: cat %s | %cling -L%T | %filecheck %s .L libcall_lib2 extern "C" int cling_testlibrary_function(); diff --git a/test/LibraryCall/callable_lib.C b/test/LibraryCall/callable_lib.C index 72a6bb165..4bf5b284e 100644 --- a/test/LibraryCall/callable_lib.C +++ b/test/LibraryCall/callable_lib.C @@ -7,7 +7,7 @@ //------------------------------------------------------------------------------ // RUN: clang -shared -DCLING_EXPORT=%dllexport %S/call_lib.c -o%T/libcall_lib%shlibext -// RUN: cat %s | %cling -L%T | FileCheck %s +// RUN: cat %s | %cling -L%T | %filecheck %s .L libcall_lib extern "C" int cling_testlibrary_function(); diff --git a/test/Lookup/args.C b/test/Lookup/args.C index d0dc38302..8f6bb2128 100644 --- a/test/Lookup/args.C +++ b/test/Lookup/args.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %cling -fno-rtti 2>&1 | %filecheck %s // Test findArgList #include "cling/Interpreter/Interpreter.h" diff --git a/test/Lookup/data.C b/test/Lookup/data.C index c8b849042..2337c12bb 100644 --- a/test/Lookup/data.C +++ b/test/Lookup/data.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %cling -fno-rtti 2>&1 | %filecheck %s // Test lookupData .rawInput 1 diff --git a/test/Lookup/func.C b/test/Lookup/func.C index b3f8c7cba..2c2674c5f 100644 --- a/test/Lookup/func.C +++ b/test/Lookup/func.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %cling -fno-rtti 2>&1 | %filecheck %s // Test lookupFunctionArgs() .rawInput #include "cling/Interpreter/Interpreter.h" diff --git a/test/Lookup/linkageSpec.C b/test/Lookup/linkageSpec.C index 0df1cf28e..e9d17da86 100644 --- a/test/Lookup/linkageSpec.C +++ b/test/Lookup/linkageSpec.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: %cling %s -Xclang -verify 2>&1 | FileCheck %s +// RUN: %cling %s -Xclang -verify 2>&1 | %filecheck %s // This test assures that extern "C" declarations are usable via .x diff --git a/test/Lookup/named.C b/test/Lookup/named.C index c051a6a11..8410030fa 100644 --- a/test/Lookup/named.C +++ b/test/Lookup/named.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %cling -fno-rtti 2>&1 | %filecheck %s // Test Lookup::Named and Namespace, used in quick simple lookups. #include "cling/Interpreter/Interpreter.h" diff --git a/test/Lookup/scope.C b/test/Lookup/scope.C index 5c6b08d4c..c47400c38 100644 --- a/test/Lookup/scope.C +++ b/test/Lookup/scope.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %cling -fno-rtti 2>&1 | %filecheck %s // Test findScope, which is essentially is a DeclContext. #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/LookupHelper.h" diff --git a/test/Lookup/tag.C b/test/Lookup/tag.C index 51736a138..82a429b1c 100644 --- a/test/Lookup/tag.C +++ b/test/Lookup/tag.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %cling -fno-rtti 2>&1 | %filecheck %s // Test Lookup::Named and Namespace, used in quick simple lookups. #include "cling/Interpreter/Interpreter.h" diff --git a/test/Lookup/template.C b/test/Lookup/template.C index 1abef423c..0252be8cf 100644 --- a/test/Lookup/template.C +++ b/test/Lookup/template.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify -fno-rtti 2>&1 | %filecheck %s // Test findClassTemplate, which is esentially is a DeclContext. #include "cling/Interpreter/Interpreter.h" #include "cling/Interpreter/LookupHelper.h" diff --git a/test/Lookup/type.C b/test/Lookup/type.C index 9173df54f..cf4cbdbe6 100644 --- a/test/Lookup/type.C +++ b/test/Lookup/type.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %cling -fno-rtti 2>&1 | %filecheck %s // Test Interpreter::lookupType() // #include "cling/Interpreter/Interpreter.h" diff --git a/test/Lookup/variadicFunc.C b/test/Lookup/variadicFunc.C index fd934b7df..a86810c33 100644 --- a/test/Lookup/variadicFunc.C +++ b/test/Lookup/variadicFunc.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -fno-rtti 2>&1 | FileCheck %s +// RUN: cat %s | %cling -fno-rtti 2>&1 | %filecheck %s // XFAIL:* // This test assures that varidiac funcions can be found by our string-based diff --git a/test/MultipleInterpreters/MultipleInterpreters.C b/test/MultipleInterpreters/MultipleInterpreters.C index 56b4c5958..da2994076 100644 --- a/test/MultipleInterpreters/MultipleInterpreters.C +++ b/test/MultipleInterpreters/MultipleInterpreters.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s // Test to check the functionality of the multiple interpreters. // Create a "child" interpreter and use gCling as its "parent". diff --git a/test/NullDeref/NonNullArg.C b/test/NullDeref/NonNullArg.C index a2bac16b5..c9089c9ca 100644 --- a/test/NullDeref/NonNullArg.C +++ b/test/NullDeref/NonNullArg.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify | %filecheck %s // XFAIL: powerpc64 //This file checks a call instruction. The called function has arguments with nonnull attribute. extern "C" int printf(const char* fmt, ...); diff --git a/test/Plugins/Simple.C b/test/Plugins/Simple.C index f44cbc260..2207563ca 100644 --- a/test/Plugins/Simple.C +++ b/test/Plugins/Simple.C @@ -1,4 +1,4 @@ -// RUN: cat %s | %cling -fplugin=%cling_obj_root/tools/plugins/example/libclingDemoPlugin%shlibext | FileCheck %s +// RUN: cat %s | %cling -fplugin=%cling_obj_root/tools/plugins/example/libclingDemoPlugin%shlibext | %filecheck %s // CHECK:Action::ParseArgs // CHECK-NEXT:Action::CreateASTConsumer diff --git a/test/Pragmas/add_env_path.C b/test/Pragmas/add_env_path.C index 91ed6809c..f5ef6ec41 100644 --- a/test/Pragmas/add_env_path.C +++ b/test/Pragmas/add_env_path.C @@ -9,7 +9,7 @@ // RUN: %mkdir "%T/subdir" || true // RUN: %rm "%T/subdir/libtest%shlibext" // RUN: clang -DCLING_EXPORT=%dllexport -shared %S/call_lib.c -o %T/subdir/libtest%shlibext -// RUN: cat %s | %cling -I %S -DENVVAR_LIB="\"%/T/subdir\"" -DENVVAR_INC="\"%/p/subdir\"" -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -I %S -DENVVAR_LIB="\"%/T/subdir\"" -DENVVAR_INC="\"%/p/subdir\"" -Xclang -verify 2>&1 | %filecheck %s extern "C" int cling_testlibrary_function(); diff --git a/test/Pragmas/load.C b/test/Pragmas/load.C index 7c3f0709f..1b6b73a86 100644 --- a/test/Pragmas/load.C +++ b/test/Pragmas/load.C @@ -7,7 +7,7 @@ //------------------------------------------------------------------------------ // RUN: clang -shared -DCLING_EXPORT=%dllexport %S/call_lib.c -o%T/libcall_lib%shlibext -// RUN: cat %s | %cling -L %T -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -L %T -Xclang -verify 2>&1 | %filecheck %s #pragma cling load("DoesNotExistPleaseRecover") // expected-error@input_line_12:1{{'DoesNotExistPleaseRecover' file not found}} diff --git a/test/Pragmas/opt.C b/test/Pragmas/opt.C index dfb4c7ede..5c9bc39b9 100644 --- a/test/Pragmas/opt.C +++ b/test/Pragmas/opt.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s extern "C" int printf(const char*,...); #include "cling/Interpreter/Interpreter.h" diff --git a/test/Prompt/BlockComments.C b/test/Prompt/BlockComments.C index 761260e7f..702dfed9c 100644 --- a/test/Prompt/BlockComments.C +++ b/test/Prompt/BlockComments.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s // Test blockComments (/* diff --git a/test/Prompt/Continuation.C b/test/Prompt/Continuation.C index f160615ce..5490e3111 100644 --- a/test/Prompt/Continuation.C +++ b/test/Prompt/Continuation.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s // Tests continuation of a line with , or \ // Be careful saving this file: some editors strip the trailing spaces at bottom diff --git a/test/Prompt/DontWrap.C b/test/Prompt/DontWrap.C index 65c60a12a..b579d4250 100644 --- a/test/Prompt/DontWrap.C +++ b/test/Prompt/DontWrap.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s // Test dontWrapDefinitions extern "C" int printf(const char*,...); diff --git a/test/Prompt/Exceptions.C b/test/Prompt/Exceptions.C index 67716f799..901cb4060 100644 --- a/test/Prompt/Exceptions.C +++ b/test/Prompt/Exceptions.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s extern "C" int printf(const char*,...); struct TheStruct { diff --git a/test/Prompt/MetaProcessor/42.X-Non-Id-Chars.C b/test/Prompt/MetaProcessor/42.X-Non-Id-Chars.C index 3ea9719c8..9501e2913 100644 --- a/test/Prompt/MetaProcessor/42.X-Non-Id-Chars.C +++ b/test/Prompt/MetaProcessor/42.X-Non-Id-Chars.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: %cling %s | FileCheck %s +// RUN: %cling %s | %filecheck %s extern "C" int printf(const char*, ...); void _42_X_Non_Id_Chars() { diff --git a/test/Prompt/MetaProcessor/CustomMeta.C b/test/Prompt/MetaProcessor/CustomMeta.C index 87e221bfd..246d699f7 100644 --- a/test/Prompt/MetaProcessor/CustomMeta.C +++ b/test/Prompt/MetaProcessor/CustomMeta.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling --metastr=//. | FileCheck %s +// RUN: cat %s | %cling --metastr=//. | %filecheck %s // Test setting of meta escape //.help // CHECK: Cling (C/C++ interpreter) meta commands usage diff --git a/test/Prompt/MetaProcessor/DotO.C b/test/Prompt/MetaProcessor/DotO.C index ec986a2d9..a544c6564 100644 --- a/test/Prompt/MetaProcessor/DotO.C +++ b/test/Prompt/MetaProcessor/DotO.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s extern "C" int printf(const char*,...); #include "cling/Interpreter/Interpreter.h" diff --git a/test/Prompt/MetaProcessor/InputValidator.C b/test/Prompt/MetaProcessor/InputValidator.C index 1f6c737bb..b64cdf9f9 100644 --- a/test/Prompt/MetaProcessor/InputValidator.C +++ b/test/Prompt/MetaProcessor/InputValidator.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling | FileCheck %s +// RUN: cat %s | %cling | %filecheck %s "simple" //CHECK: (const char [7]) "simple" "It's me" diff --git a/test/Prompt/MetaProcessor/Macros.C b/test/Prompt/MetaProcessor/Macros.C index 20ea4821b..3cb0bc9a1 100644 --- a/test/Prompt/MetaProcessor/Macros.C +++ b/test/Prompt/MetaProcessor/Macros.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling | FileCheck %s +// RUN: cat %s | %cling | %filecheck %s //XFAIL: * // This test should test the unnamed macro support once it is moved in cling. .x Commands.macro diff --git a/test/Prompt/MetaProcessor/Regression.C b/test/Prompt/MetaProcessor/Regression.C index 49b5bc8ba..41f47a07f 100644 --- a/test/Prompt/MetaProcessor/Regression.C +++ b/test/Prompt/MetaProcessor/Regression.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p | FileCheck %s +// RUN: cat %s | %cling -I%p | %filecheck %s // This file should be used as regression test for the meta processing subsystem // Reproducers of fixed bugs should be put here diff --git a/test/Prompt/MetaProcessor/Trace.C b/test/Prompt/MetaProcessor/Trace.C index 570ee9485..98892d4e7 100644 --- a/test/Prompt/MetaProcessor/Trace.C +++ b/test/Prompt/MetaProcessor/Trace.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling | FileCheck %s +// RUN: cat %s | %cling | %filecheck %s int abcdefghxyz = 10 //CHECK: (int) 10 .trace ast abcdefghxyz diff --git a/test/Prompt/OutputRedirect.C b/test/Prompt/OutputRedirect.C index 1ddb1f1ac..9e30974fb 100644 --- a/test/Prompt/OutputRedirect.C +++ b/test/Prompt/OutputRedirect.C @@ -1,11 +1,11 @@ -// RUN: cat %s | %cling -DCLING_TMP="\"%/T\"" | FileCheck --check-prefix=CHECKOUT %s -// RUN: cat %T/outfile.txt | FileCheck --check-prefix=CHECK-REDIRECTOUT %s -// RUN: cat %T/errfile.txt | FileCheck --check-prefix=CHECK-REDIRECTERR %s -// RUN: cat %T/bothfile.txt | FileCheck --check-prefix=CHECK-REDIRECTBOTH %s -// RUN: cat %T/anotheroutfile.txt | FileCheck --check-prefix=CHECK-REDIRECTANOTHER %s -// RUN: cat %T/nospace.txt | FileCheck --check-prefix=CHECK-NOSPACE %s -// RUN: cat %s | %cling -DCLING_TMP="\"%/T\"" 2> %T/stderr.txt && cat %T/stderr.txt | FileCheck --check-prefix=CHECKERR %s -// RUN: cat %s | %cling -DCLING_TMP="\"%/T\"" 2>&1 | FileCheck --check-prefix=CHECKERR --check-prefix=CHECKOUT %s +// RUN: cat %s | %cling -DCLING_TMP="\"%/T\"" | %filecheck --check-prefix=CHECKOUT %s +// RUN: cat %T/outfile.txt | %filecheck --check-prefix=CHECK-REDIRECTOUT %s +// RUN: cat %T/errfile.txt | %filecheck --check-prefix=CHECK-REDIRECTERR %s +// RUN: cat %T/bothfile.txt | %filecheck --check-prefix=CHECK-REDIRECTBOTH %s +// RUN: cat %T/anotheroutfile.txt | %filecheck --check-prefix=CHECK-REDIRECTANOTHER %s +// RUN: cat %T/nospace.txt | %filecheck --check-prefix=CHECK-NOSPACE %s +// RUN: cat %s | %cling -DCLING_TMP="\"%/T\"" 2> %T/stderr.txt && cat %T/stderr.txt | %filecheck --check-prefix=CHECKERR %s +// RUN: cat %s | %cling -DCLING_TMP="\"%/T\"" 2>&1 | %filecheck --check-prefix=CHECKERR --check-prefix=CHECKOUT %s #include diff --git a/test/Prompt/PreprocessorIf.C b/test/Prompt/PreprocessorIf.C index 911455c5a..73ee1ef55 100644 --- a/test/Prompt/PreprocessorIf.C +++ b/test/Prompt/PreprocessorIf.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -DPROBABLY_DEFINED -DDEF_DEF -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -DPROBABLY_DEFINED -DDEF_DEF -Xclang -verify 2>&1 | %filecheck %s // Test preprocessorIfSupport #if 0 diff --git a/test/Prompt/RawInput.C b/test/Prompt/RawInput.C index 55a99d630..dbe7ff122 100644 --- a/test/Prompt/RawInput.C +++ b/test/Prompt/RawInput.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling | FileCheck %s +// RUN: cat %s | %cling | %filecheck %s .rawInput 1 diff --git a/test/Prompt/RecursiveGlobalInits.C b/test/Prompt/RecursiveGlobalInits.C index 2b66a8407..2631481a9 100644 --- a/test/Prompt/RecursiveGlobalInits.C +++ b/test/Prompt/RecursiveGlobalInits.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling | FileCheck %s +// RUN: cat %s | %cling | %filecheck %s // Checks for infinite recursion when we combine nested calls of process line // with global initializers. diff --git a/test/Prompt/Regression.C b/test/Prompt/Regression.C index 161672a31..f1757b84e 100644 --- a/test/Prompt/Regression.C +++ b/test/Prompt/Regression.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p | FileCheck %s +// RUN: cat %s | %cling -I%p | %filecheck %s // This file should be used as regression test for the meta processing subsystem // Reproducers of fixed bugs should be put here diff --git a/test/Prompt/ValuePrinter/Assignments.C b/test/Prompt/ValuePrinter/Assignments.C index ba30aae71..7da49cc96 100644 --- a/test/Prompt/ValuePrinter/Assignments.C +++ b/test/Prompt/ValuePrinter/Assignments.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling | FileCheck %s +// RUN: cat %s | %cling | %filecheck %s int a = 12; a // CHECK: (int) 12 diff --git a/test/Prompt/ValuePrinter/Collections.C b/test/Prompt/ValuePrinter/Collections.C index 7f4bd9274..355f84af0 100644 --- a/test/Prompt/ValuePrinter/Collections.C +++ b/test/Prompt/ValuePrinter/Collections.C @@ -7,7 +7,7 @@ //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s #include #include diff --git a/test/Prompt/ValuePrinter/Destruction.C b/test/Prompt/ValuePrinter/Destruction.C index 5eb2bf690..43c0f1bc7 100755 --- a/test/Prompt/ValuePrinter/Destruction.C +++ b/test/Prompt/ValuePrinter/Destruction.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s // Test valueDestruction .rawInput diff --git a/test/Prompt/ValuePrinter/Ptrs.C b/test/Prompt/ValuePrinter/Ptrs.C index a5efe7c47..d39e2ca62 100644 --- a/test/Prompt/ValuePrinter/Ptrs.C +++ b/test/Prompt/ValuePrinter/Ptrs.C @@ -7,7 +7,7 @@ //------------------------------------------------------------------------------ -// RUN: cat %s | %cling | FileCheck %s +// RUN: cat %s | %cling | %filecheck %s #include #include diff --git a/test/Prompt/ValuePrinter/Strings.C b/test/Prompt/ValuePrinter/Strings.C index ff2c0dc8d..0f8232e8e 100644 --- a/test/Prompt/ValuePrinter/Strings.C +++ b/test/Prompt/ValuePrinter/Strings.C @@ -7,7 +7,7 @@ //------------------------------------------------------------------------------ // Windows wants -Wno-deprecated-declarations -//RUN: cat %s | %cling -Wno-deprecated-declarations -Xclang -verify 2>&1 | FileCheck %s +//RUN: cat %s | %cling -Wno-deprecated-declarations -Xclang -verify 2>&1 | %filecheck %s #include #ifdef _WIN32 diff --git a/test/Prompt/ValuePrinter/Templates.C b/test/Prompt/ValuePrinter/Templates.C index 3fff2a827..2008eb4c1 100644 --- a/test/Prompt/ValuePrinter/Templates.C +++ b/test/Prompt/ValuePrinter/Templates.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling | FileCheck %s +// RUN: cat %s | %cling | %filecheck %s template struct F{ enum {RET=F::RET*n} ; }; diff --git a/test/Prompt/cppmacros.C b/test/Prompt/cppmacros.C index cc1aa0195..ae13b8d71 100644 --- a/test/Prompt/cppmacros.C +++ b/test/Prompt/cppmacros.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: %cling %s | FileCheck %s +// RUN: %cling %s | %filecheck %s extern "C" int printf(const char* fmt, ...); #define MYMACRO(v) \ if (v) { \ diff --git a/test/Prompt/cppmacros_remember.C b/test/Prompt/cppmacros_remember.C index 7b593f97b..95f19b84e 100644 --- a/test/Prompt/cppmacros_remember.C +++ b/test/Prompt/cppmacros_remember.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling | FileCheck %s +// RUN: cat %s | %cling | %filecheck %s #include extern "C" int printf(const char* fmt, ...); diff --git a/test/Prompt/cppundef.C b/test/Prompt/cppundef.C index c730d4dc0..a09edddc5 100644 --- a/test/Prompt/cppundef.C +++ b/test/Prompt/cppundef.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: %cling %s | FileCheck %s +// RUN: %cling %s | %filecheck %s #ifdef MYMACRO # undef MYMACRO #endif diff --git a/test/Prompt/decls.C b/test/Prompt/decls.C index 756a8e050..f7665c4bb 100644 --- a/test/Prompt/decls.C +++ b/test/Prompt/decls.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p | FileCheck %s +// RUN: cat %s | %cling -I%p | %filecheck %s #include struct S{int i;} ss; diff --git a/test/Prompt/globalinit.C b/test/Prompt/globalinit.C index dd370f2b3..d04e296b0 100644 --- a/test/Prompt/globalinit.C +++ b/test/Prompt/globalinit.C @@ -6,8 +6,8 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: %cling %s -DTEST_PATH="\"%/p/\"" -Xclang -verify 2>&1 | FileCheck %s -// RUN: %cling %s -I%p -Xclang -verify 2>&1 | FileCheck %s +// RUN: %cling %s -DTEST_PATH="\"%/p/\"" -Xclang -verify 2>&1 | %filecheck %s +// RUN: %cling %s -I%p -Xclang -verify 2>&1 | %filecheck %s #include "cling/Interpreter/Interpreter.h" diff --git a/test/Prompt/globals.C b/test/Prompt/globals.C index bb3807763..8dbceb806 100644 --- a/test/Prompt/globals.C +++ b/test/Prompt/globals.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling | FileCheck %s +// RUN: cat %s | %cling | %filecheck %s extern "C" int printf(const char*,...); extern "C" void exit(int); diff --git a/test/Prompt/initorder.C b/test/Prompt/initorder.C index 952e6c0b0..bd35d7e0d 100644 --- a/test/Prompt/initorder.C +++ b/test/Prompt/initorder.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling | FileCheck %s +// RUN: cat %s | %cling | %filecheck %s // Checks: // Savannah #99210 https://savannah.cern.ch/bugs/index.php?99210 diff --git a/test/Recursion/Exceptions.C b/test/Recursion/Exceptions.C index 8a0300b30..7226aae59 100644 --- a/test/Recursion/Exceptions.C +++ b/test/Recursion/Exceptions.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s extern "C" int printf(const char*,...); // When interpreting code, raised exceptions can be catched by the call site. diff --git a/test/Recursion/RecursiveClingInstances.C b/test/Recursion/RecursiveClingInstances.C index dd36761b3..316198139 100644 --- a/test/Recursion/RecursiveClingInstances.C +++ b/test/Recursion/RecursiveClingInstances.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -I%p 2>&1 | FileCheck %s +// RUN: cat %s | %cling -I%p 2>&1 | %filecheck %s // Tests the ability of cling to host itself. We can have cling instances in // cling's runtime. This is important for people, who use cling embedded in diff --git a/test/SourceCall/ErrorMacro.C b/test/SourceCall/ErrorMacro.C index 73fa9ffa3..c9ad5c347 100644 --- a/test/SourceCall/ErrorMacro.C +++ b/test/SourceCall/ErrorMacro.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s +// RUN: cat %s | %cling -Xclang -verify 2>&1 | %filecheck %s int example() { } // expected-error {{control reaches end of non-void function}} diff --git a/test/SourceCall/decls.C b/test/SourceCall/decls.C index ec6a4ca72..3a90268ce 100644 --- a/test/SourceCall/decls.C +++ b/test/SourceCall/decls.C @@ -6,7 +6,7 @@ // LICENSE.TXT for details. //------------------------------------------------------------------------------ -// RUN: %cling %s | FileCheck %s +// RUN: %cling %s | %filecheck %s #include #include diff --git a/test/SourceCall/test_01.c b/test/SourceCall/test_01.c index dd6fb9daf..a73609a02 100644 --- a/test/SourceCall/test_01.c +++ b/test/SourceCall/test_01.c @@ -6,11 +6,11 @@ // LICENSE.TXT for details. //----------------------------------------------------------------------------*/ -// RUN: %cling %s | FileCheck %s +// RUN: %cling %s | %filecheck %s // Ensure the .c file to be processed // is in the working directory (issue ROOT-6244) -// RUN: cd `dirname %s` ; %cling %s | FileCheck %s +// RUN: cd `dirname %s` ; %cling %s | %filecheck %s #ifdef __clang__ diff --git a/test/SourceCall/unresolved.C b/test/SourceCall/unresolved.C index 41f5770ea..8a89b0ca9 100644 --- a/test/SourceCall/unresolved.C +++ b/test/SourceCall/unresolved.C @@ -7,7 +7,7 @@ //------------------------------------------------------------------------------ // RUN: cat %s | %cling -// RUN: cat %s | %cling 2>&1 | FileCheck %s +// RUN: cat %s | %cling 2>&1 | %filecheck %s // Test handling and recovery from calling an unresolved symbol. extern int foo(); // extern C++ diff --git a/test/lit.cfg b/test/lit.cfg index 8eb82df4a..b5ff81049 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -144,3 +144,13 @@ if libcudart_path is not None: config.substitutions.append(('%cudasmlevel', '--cuda-gpu-arch=sm_' + os.environ['CLING_TEST_CUDA_SM_LEVEL'])) else: config.substitutions.append(('%cudasmlevel', "")) + +# FileCheck might have different name in binary build +if not os.path.exists(os.path.join(config.test_exec_root, "..", "..", "clang", "test")): + llvm_revision = urlopen( + "https://raw.githubusercontent.com/root-project/cling/master/LastKnownGoodLLVMSVNRevision.txt").readline().strip().decode( + 'utf-8') + assert llvm_revision == "release_90" + config.substitutions.append(('%filecheck', "FileCheck-9")) +else: + config.substitutions.append(('%filecheck', "FileCheck")) From 4344563357afe112fdc4989d12cbbdf7a553692d Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Sat, 27 Mar 2021 14:16:46 +0530 Subject: [PATCH 29/36] Fix Python invocation --- .github/workflows/ci.yml | 9 +++------ .../RunAgainstClangTestSuite/RunAgainstClangTestSuite.C | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0d99de1b..215b51449 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,9 +81,6 @@ jobs: if: runner.os == 'macOS' - name: Display compiler version run: $CC --version - - name: Set Python 3 as default - run: | - sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10 - name: Execute cpt run: | if [ ${{ github.event_name }} = 'pull_request' ]; then @@ -99,11 +96,11 @@ jobs: fi export CLING_BUILD_FLAGS="$CLING_BUILD_FLAGS -DCLANG_ENABLE_ARCMT=OFF -DCLANG_ENABLE_STATIC_ANALYZER=OFF -DLLVM_ENABLE_WARNINGS=OFF -DCLING_ENABLE_WARNINGS=ON" if [[ ${{ matrix.name }} == *"compile"* ]]; then - python cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --verbose + python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --verbose # elif [[ ${{ matrix.name }} == *"fromtar"* ]]; then - # python cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --with-llvm-tar --verbose + # python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --with-llvm-tar --verbose else - python cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --verbose + python3 cpt.py -y --check-requirements --current-dev=tar --with-cmake-flags="$CLING_BUILD_FLAGS" --with-cling-url=https://github.com/$REPO --cling-branch=${{ github.head_ref }} --with-binary-llvm --verbose fi working-directory: tools/packaging/ - name: Setup tmate session diff --git a/test/CodeUnloading/RunAgainstClangTestSuite/RunAgainstClangTestSuite.C b/test/CodeUnloading/RunAgainstClangTestSuite/RunAgainstClangTestSuite.C index a87e0c3c0..16e306101 100644 --- a/test/CodeUnloading/RunAgainstClangTestSuite/RunAgainstClangTestSuite.C +++ b/test/CodeUnloading/RunAgainstClangTestSuite/RunAgainstClangTestSuite.C @@ -1,4 +1,4 @@ -// RUN: cd "%cling_obj_root/../clang/test" && python "%src_include_dir/../../../utils/lit/lit.py" -v -sv --param clang_site_config="%cling_obj_root/../clang/test/lit.site.cfg" "%/p/../../../clang/test/Sema/address-constant.c" +// RUN: cd "%cling_obj_root/../clang/test" && python3 "%src_include_dir/../../../utils/lit/lit.py" -v -sv --param clang_site_config="%cling_obj_root/../clang/test/lit.site.cfg" "%/p/../../../clang/test/Sema/address-constant.c" // REQUIRES: vanilla-cling From a4a1ee8454d9a7c854ac084b6605ea18e7601962 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Sat, 27 Mar 2021 16:23:46 +0530 Subject: [PATCH 30/36] Drop Python 2 from Cling CMake --- CMakeLists.txt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a651ad9ec..ff775def8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,19 +109,14 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} ) if(LLVM_INCLUDE_TESTS) - set(Python_ADDITIONAL_VERSIONS 2.7) - include(FindPythonInterp) - if(NOT PYTHONINTERP_FOUND) + find_package (Python3 COMPONENTS Interpreter) + if(NOT Python3_FOUND) message(FATAL_ERROR -"Unable to find Python interpreter, required for builds and testing. +"Unable to find Python 3 interpreter, required for builds and testing. Please install Python or specify the PYTHON_EXECUTABLE CMake variable.") endif() - if( ${PYTHON_VERSION_STRING} VERSION_LESS 2.7 ) - message(FATAL_ERROR "Python 2.7 or newer is required") - endif() - # Check prebuilt llvm/utils. if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX} AND EXISTS ${LLVM_TOOLS_BINARY_DIR}/count${CMAKE_EXECUTABLE_SUFFIX} From 6b84a395449ebd2c33127504ebd404d7ec708792 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Sat, 27 Mar 2021 22:23:38 +0530 Subject: [PATCH 31/36] Fix lit invocation --- test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 253486b14..5338089e5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -54,6 +54,7 @@ add_custom_target(cling-test-depends DEPENDS clingDemoPlugin ${CLING_TEST_DEPS}) set(LLVM_LIT_OUTPUT_DIR "${LLVM_BINARY_DIR}/bin") add_lit_testsuite(check-cling "Running the Cling regression tests" ${CMAKE_CURRENT_BINARY_DIR} + LIT ${LIT_COMMAND} PARAMS ${CLING_TEST_PARAMS} DEPENDS ${CLING_TEST_DEPS} ARGS ${CLING_TEST_EXTRA_ARGS} From 2c6025e8a261ad7307601f0c4b548d38bfefa16e Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Sun, 28 Mar 2021 00:42:38 +0530 Subject: [PATCH 32/36] Build FileCheck? --- tools/packaging/cpt.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 6ecdd7da8..8d877984e 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -578,8 +578,6 @@ def compile(arg): cmake_config_flags = (srcdir + ' -DLLVM_BUILD_TOOLS=Off -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} ' .format(build.buildType, TMP_PREFIX) + ' -DLLVM_TARGETS_TO_BUILD="host;NVPTX" ' + EXTRA_CMAKE_FLAGS) - if os.path.exists(exec_subprocess_check_output("which lit", "/").strip()): - cmake_config_flags += "-DLLVM_EXTERNAL_LIT=" + exec_subprocess_check_output("which lit", "/").strip() # configure cling build.config(cmake_config_flags) @@ -622,9 +620,6 @@ def compile_for_binary(arg): ' -DLLVM_TARGETS_TO_BUILD=host;NVPTX -DCLING_CXX_HEADERS=ON -DCLING_INCLUDE_TESTS=ON' + EXTRA_CMAKE_FLAGS) - if os.path.exists(exec_subprocess_check_output("which lit", "/").strip()): - cmake_config_flags += " -DLLVM_EXTERNAL_LIT=" + exec_subprocess_check_output("which lit", "/").strip() - box_draw('Configure Cling with CMake ' + cmake_config_flags) exec_subprocess_call('%s %s' % (CMAKE, cmake_config_flags), LLVM_OBJ_ROOT, True) box_draw('Building %s (using %d cores)' % ("cling", multiprocessing.cpu_count())) @@ -2204,7 +2199,7 @@ def custom_input(prompt, always_yes=False): 'cling-' + DIST + '-' + REV + '-' + platform.machine().lower() + '-' + VERSION)) install_prefix() if not args['no_test']: - if args['with_binary_llvm'] and tar_required: + if args['with_binary_llvm']: setup_tests() test_cling() tarball() From 851033addebd40660a86fbcd1df41a3e5ec4261b Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Sun, 28 Mar 2021 00:52:01 +0530 Subject: [PATCH 33/36] Get FileCheck via symlink --- tools/packaging/cpt.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 8d877984e..851346181 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -719,6 +719,9 @@ def runSingleTest(test, Idx = 2, Recurse = True): pass def setup_tests(): + filecheck_path = exec_subprocess_check_output("which FileCheck-9", "/") + exec_subprocess_call("sudo ln -s {0} {1}".format(filecheck_path, LLVM_OBJ_ROOT)) + ''' global tar_required llvm_revision = urlopen( "https://raw.githubusercontent.com/root-project/cling/master/LastKnownGoodLLVMSVNRevision.txt").readline().strip().decode( @@ -787,6 +790,7 @@ def setup_tests(): stdout=None, stderr=subprocess.STDOUT, ).communicate("yes".encode("utf-8")) + ''' def test_cling(): From 5ffddaea7398b4948191c7949198ab4045927281 Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Sun, 28 Mar 2021 00:52:42 +0530 Subject: [PATCH 34/36] Fix syntax --- tools/packaging/cpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 851346181..0acd42af2 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -720,7 +720,7 @@ def runSingleTest(test, Idx = 2, Recurse = True): def setup_tests(): filecheck_path = exec_subprocess_check_output("which FileCheck-9", "/") - exec_subprocess_call("sudo ln -s {0} {1}".format(filecheck_path, LLVM_OBJ_ROOT)) + exec_subprocess_call("sudo ln -s {0} {1}".format(filecheck_path, LLVM_OBJ_ROOT), "/") ''' global tar_required llvm_revision = urlopen( From fb47ce71fdd91c9fdbd8c23423efc2c8a9f9919c Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Sun, 28 Mar 2021 00:56:51 +0530 Subject: [PATCH 35/36] Fix more syntax --- tools/packaging/cpt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 0acd42af2..53ce4d101 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -720,7 +720,8 @@ def runSingleTest(test, Idx = 2, Recurse = True): def setup_tests(): filecheck_path = exec_subprocess_check_output("which FileCheck-9", "/") - exec_subprocess_call("sudo ln -s {0} {1}".format(filecheck_path, LLVM_OBJ_ROOT), "/") + symlink_path = os.path.join(LLVM_OBJ_ROOT, "FileCheck") + exec_subprocess_call("sudo ln -s {0} {1}".format(filecheck_path, symlink_path), "/") ''' global tar_required llvm_revision = urlopen( From b52db6c0bd13eefb59b4c1e843601e94cef3939d Mon Sep 17 00:00:00 2001 From: Pratyush Das Date: Sun, 28 Mar 2021 01:13:09 +0530 Subject: [PATCH 36/36] Set Python CMake variable --- tools/packaging/cpt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 53ce4d101..174b4ccea 100755 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -615,8 +615,8 @@ def compile_for_binary(arg): patch_path = os.path.join(CLING_SRC_DIR, "patches", "llvm90-headers") build = Build() - cmake_config_flags = (clangdir + ' -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' - .format(build.buildType, TMP_PREFIX, patch_path) + llvm_flags + + cmake_config_flags = (clangdir + ' -DCMAKE_BUILD_TYPE={0} -DCMAKE_INSTALL_PREFIX={1} -DPYTHON_EXECUTABLE={2} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ' + .format(build.buildType, TMP_PREFIX, patch_path, sys.executable) + llvm_flags + ' -DLLVM_TARGETS_TO_BUILD=host;NVPTX -DCLING_CXX_HEADERS=ON -DCLING_INCLUDE_TESTS=ON' + EXTRA_CMAKE_FLAGS)