diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c5f1c5ba27f..74971e5da41 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -4,15 +4,6 @@ FROM mcr.microsoft.com/vscode/devcontainers/universal:1-linux USER root -RUN apt update \ - && apt-get install -y --no-install-recommends \ - ninja-build \ - clang-11 \ - clang-tidy-11 \ - build-essential \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/ - # Install CMake 3.20 (required since apt-get uses 3.16 and repo requires 3.20) RUN curl -SsL https://github.com/Kitware/CMake/releases/download/v3.20.5/cmake-3.20.5-linux-x86_64.sh -o cmakeinstall.sh \ && echo "f582e02696ceee81818dc3378531804b2213ed41c2a8bc566253d16d894cefab cmakeinstall.sh" | sha256sum -c --strict - \ @@ -20,5 +11,4 @@ RUN curl -SsL https://github.com/Kitware/CMake/releases/download/v3.20.5/cmake-3 && ./cmakeinstall.sh --prefix=/usr/local --exclude-subdir \ && rm cmakeinstall.sh - USER codespace diff --git a/global.json b/global.json index 86178bfb451..520dbdfc3a0 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "Microsoft.Quantum.Sdk": "0.18.2109163417-beta" + "Microsoft.Quantum.Sdk": "0.22.185393-alpha" } } diff --git a/src/Qir/.clang-tidy b/src/Qir/.clang-tidy index a306ababc4c..115b29be7c0 100644 --- a/src/Qir/.clang-tidy +++ b/src/Qir/.clang-tidy @@ -2,7 +2,8 @@ # https://clang.llvm.org/extra/clang-tidy/checks/list.html Checks: - 'bugprone-*,readability-identifier-*,readability-braces-around-statements,cert*,\ + 'bugprone-*,-bugprone-easily-swappable-parameters,\ + readability-identifier-*,readability-braces-around-statements,cert*,\ -llvmlibc-callee-namespace,-llvmlibc-implementation-in-namespace,\ -llvmlibc-restrict-system-libc-headers,-modernize-use-trailing-return-type,\ -fuchsia-default-arguments-calls,-fuchsia-default-arguments-declarations, diff --git a/src/Qir/Common/cmake/qir_cmake_include.cmake b/src/Qir/Common/cmake/qir_cmake_include.cmake index 9ad60d716ea..3117f4eb896 100644 --- a/src/Qir/Common/cmake/qir_cmake_include.cmake +++ b/src/Qir/Common/cmake/qir_cmake_include.cmake @@ -81,6 +81,13 @@ set(WARNING_FLAGS "${WARNING_FLAGS} -Weverything") # -Wpre-c++20-compat. # -Wpre-c++2b-compat-pedantic (= -Wpre-c++2b-compat). +include(CheckCCompilerFlag) +check_c_compiler_flag(-Wreserved-identifier HAVE_RESERVED_IDENTIFIER_WARNING) +if(HAVE_RESERVED_IDENTIFIER_WARNING) + # We need to be able to use `__` prefix for QIR names like `__quantum__rt__*` and `__quantum__qis__*`. + set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-reserved-identifier") +endif() + # https://clang.llvm.org/docs/DiagnosticsReference.html#wc-98-compat-pedantic set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-c++98-compat-pedantic") diff --git a/src/Qir/Runtime/README.md b/src/Qir/Runtime/README.md index ca78e33afa0..66db0a7d061 100644 --- a/src/Qir/Runtime/README.md +++ b/src/Qir/Runtime/README.md @@ -26,7 +26,7 @@ while on macOS, `prerequisites.ps1` relies on the [`brew` package manager](https #### Windows pre-reqs -1. Install Clang 11, Ninja and CMake from the public distros. +1. Install Clang 13, Ninja and CMake from the public distros. 1. Add all three to your/system `%PATH%`. 1. Install VS 2019 and enable "Desktop development with C++" component (Clang uses MSVC's standard library on Windows). 1. Install clang-tidy and clang-format if your Clang/LLVM packages didn't include the tools. @@ -42,11 +42,11 @@ Running cmake from the editors will likely default to MSVC or clang-cl and fail. 1. In the Ubuntu's terminal: 1. `$ sudo apt install cmake` (`$ cmake --version` should return 3.16.3) 1. `$ sudo apt-get install ninja-build` (`$ ninja --version` should return 1.10.0) - 1. `$ sudo apt install clang-11` (`$ clang++-11 --version` should return 11.0.0) + 1. `$ sudo apt install clang-13` (`$ clang++-13 --version` should return 13.0.0) 1. Set Clang as the preferred C/C++ compiler: - - $ export CC=/usr/bin/clang-11 - - $ export CXX=/usr/bin/clang++-11 - 1. `$ sudo apt install clang-tidy-11` (`$ clang-tidy-11 --version` should return 'LLVM version 11.0.0') + - $ export CC=/usr/bin/clang-13 + - $ export CXX=/usr/bin/clang++-13 + 1. `$ sudo apt install clang-tidy-13` (`$ clang-tidy-13 --version` should return 'LLVM version 13.0.0') 1. Install the same version of dotnet as specified by qsharp-runtime [README](../../../README.md) See [https://code.visualstudio.com/docs/remote/wsl] on how to use VS Code with WSL. diff --git a/src/Qir/Runtime/lib/QIR/QubitManager.cpp b/src/Qir/Runtime/lib/QIR/QubitManager.cpp index 329fbab32b1..8a506827e79 100644 --- a/src/Qir/Runtime/lib/QIR/QubitManager.cpp +++ b/src/Qir/Runtime/lib/QIR/QubitManager.cpp @@ -423,7 +423,7 @@ namespace Quantum { areaIndex = freeQubitsInAreas[(size_t)areaIndex].prevAreaWithFreeQubits; id = freeQubitsInAreas[(size_t)areaIndex].FreeQubitsReuseAllowed.TakeQubitFromFront( - sharedQubitStatusArray); + sharedQubitStatusArray); } while ((areaIndex != 0) && (id == NoneMarker)); // We remember previous area where a free qubit was found or 0 if none were found. diff --git a/src/Qir/Runtime/lib/QIR/arrays.cpp b/src/Qir/Runtime/lib/QIR/arrays.cpp index b9f1b78ee16..5c980a9fe26 100644 --- a/src/Qir/Runtime/lib/QIR/arrays.cpp +++ b/src/Qir/Runtime/lib/QIR/arrays.cpp @@ -118,7 +118,7 @@ QirArray::QirArray(TItemCount countItems, TItemSize itemSizeBytes, TDimCount dim assert(this->count * (TBufSize)itemSizeInBytes < std::numeric_limits::max()); // Using `<` rather than `<=` to calm down the compiler on 32-bit arch. - const TBufSize bufferSize = this->count * itemSizeInBytes; + const TBufSize bufferSize = (TBufSize)this->count * (TBufSize)itemSizeInBytes; if (bufferSize > 0) { this->buffer = new char[bufferSize]; @@ -146,7 +146,7 @@ QirArray::QirArray(const QirArray& other) assert((TBufSize)(this->count) * this->itemSizeInBytes < std::numeric_limits::max()); // Using `<` rather than `<=` to calm down the compiler on 32-bit arch. - const TBufSize size = this->count * this->itemSizeInBytes; + const TBufSize size = (TBufSize)this->count * (TBufSize)this->itemSizeInBytes; if (this->count > 0) { this->buffer = new char[size]; @@ -167,7 +167,7 @@ QirArray::~QirArray() char* QirArray::GetItemPointer(TItemCount index) const { assert(index < this->count); - return &this->buffer[index * this->itemSizeInBytes]; + return &this->buffer[static_cast(index * this->itemSizeInBytes)]; } void QirArray::Append(const QirArray* other) @@ -178,7 +178,7 @@ void QirArray::Append(const QirArray* other) assert((TBufSize)(other->count) * other->itemSizeInBytes < std::numeric_limits::max()); // Using `<` rather than `<=` to calm down the compiler on 32-bit arch. - const TBufSize otherSize = other->count * other->itemSizeInBytes; + const TBufSize otherSize = (TBufSize)other->count * (TBufSize)other->itemSizeInBytes; if (otherSize == 0) { @@ -187,7 +187,7 @@ void QirArray::Append(const QirArray* other) assert((TBufSize)(this->count) * this->itemSizeInBytes < std::numeric_limits::max()); // Using `<` rather than `<=` to calm down the compiler on 32-bit arch. - const TBufSize thisSize = this->count * this->itemSizeInBytes; + const TBufSize thisSize = (TBufSize)this->count * (TBufSize)this->itemSizeInBytes; char* newBuffer = new char[thisSize + otherSize]; if (thisSize) @@ -585,14 +585,16 @@ extern "C" assert((QirArray::TBufSize)rangeRunCount * itemSizeInBytes < std::numeric_limits::max()); // Using `<` rather than `<=` to calm down the compiler on 32-bit arch. - const QirArray::TBufSize rangeChunkSize = rangeRunCount * itemSizeInBytes; + const QirArray::TBufSize rangeChunkSize = + (QirArray::TBufSize)rangeRunCount * (QirArray::TBufSize)itemSizeInBytes; QirArray::TItemCount dst = 0; QirArray::TItemCount src = (QirArray::TItemCount)(singleIndexRunCount * range.start); while (src < array->count) { assert(dst < slice->count); - memcpy(&slice->buffer[dst * itemSizeInBytes], &array->buffer[src * itemSizeInBytes], rangeChunkSize); + memcpy(&slice->buffer[static_cast(dst * itemSizeInBytes)], + &array->buffer[static_cast(src * itemSizeInBytes)], rangeChunkSize); src += rowCount; dst += rangeRunCount; } @@ -603,9 +605,10 @@ extern "C" assert((QirArray::TBufSize)singleIndexRunCount * itemSizeInBytes < std::numeric_limits::max()); // Using `<` rather than `<=` to calm down the compiler on 32-bit arch. - const QirArray::TBufSize chunkSize = singleIndexRunCount * itemSizeInBytes; - QirArray::TItemCount dst = 0; - QirArray::TItemCount src = (QirArray::TItemCount)(singleIndexRunCount * range.start); + const QirArray::TBufSize chunkSize = + (QirArray::TBufSize)singleIndexRunCount * (QirArray::TBufSize)itemSizeInBytes; + QirArray::TItemCount dst = 0; + QirArray::TItemCount src = (QirArray::TItemCount)(singleIndexRunCount * range.start); while (src < array->count) { assert(dst < slice->count); @@ -613,12 +616,14 @@ extern "C" int64_t srcInner = src; // The `srcInner` can go negative in the end of the last iteration. for (int64_t index = range.start; index != range.end; index += range.step) { - assert((dst * itemSizeInBytes + chunkSize) <= (slice->count * slice->itemSizeInBytes)); + assert(((QirArray::TItemSize)dst * itemSizeInBytes + (QirArray::TItemSize)chunkSize) <= + (QirArray::TItemSize)slice->count * slice->itemSizeInBytes); assert((srcInner * (int64_t)itemSizeInBytes + (int64_t)chunkSize) <= - (array->count * array->itemSizeInBytes)); + ((int64_t)array->count * (int64_t)array->itemSizeInBytes)); assert(srcInner >= 0); - memcpy(&slice->buffer[dst * itemSizeInBytes], &array->buffer[srcInner * itemSizeInBytes], chunkSize); + memcpy(&slice->buffer[static_cast(dst * itemSizeInBytes)], + &array->buffer[static_cast(srcInner * itemSizeInBytes)], chunkSize); srcInner += (singleIndexRunCount * range.step); dst += singleIndexRunCount; } @@ -660,14 +665,16 @@ extern "C" std::numeric_limits::max()); // Using `<` rather than `<=` to calm down the compiler on 32-bit arch. - const QirArray::TBufSize chunkSize = singleIndexRunCount * itemSizeInBytes; + const QirArray::TBufSize chunkSize = + (QirArray::TBufSize)singleIndexRunCount * (QirArray::TBufSize)itemSizeInBytes; QirArray::TItemCount dst = 0; QirArray::TItemCount src = (QirArray::TItemCount)(singleIndexRunCount * index); while (src < array->count) { assert(dst < project->count); - memcpy(&project->buffer[dst * itemSizeInBytes], &array->buffer[src * itemSizeInBytes], chunkSize); + memcpy(&project->buffer[static_cast(dst * itemSizeInBytes)], + &array->buffer[static_cast(src * itemSizeInBytes)], chunkSize); src += rowCount; dst += singleIndexRunCount; } diff --git a/src/Qir/Runtime/lib/QIR/callables.cpp b/src/Qir/Runtime/lib/QIR/callables.cpp index 93cd1dee466..2108d574e54 100644 --- a/src/Qir/Runtime/lib/QIR/callables.cpp +++ b/src/Qir/Runtime/lib/QIR/callables.cpp @@ -371,7 +371,7 @@ QirTupleHeader* FlattenControlArrays(QirTupleHeader* tuple, int depth) // Copy the controls into the new array. This array doesn't own the qubits so must use the generic constructor. QirArray* combinedControls = new QirArray(cControls, qubitSize); char* dst = combinedControls->buffer; - [[maybe_unused]] const char* dstEnd = dst + qubitSize * cControls; + [[maybe_unused]] const char* dstEnd = dst + static_cast(qubitSize * cControls); current = outer; QirTupleHeader* last = nullptr; for (int i = 0; i < depth; i++) @@ -383,7 +383,7 @@ QirTupleHeader* FlattenControlArrays(QirTupleHeader* tuple, int depth) QirArray* controls = current->controls; - const QirArray::TBufSize blockSize = qubitSize * controls->count; + const QirArray::TBufSize blockSize = (QirArray::TBufSize)qubitSize * (QirArray::TBufSize)controls->count; // Make sure we don't overflow `TBufSize` on 32-bit arch: assert((blockSize >= qubitSize) && (blockSize >= controls->count)); diff --git a/src/Qir/Runtime/lib/Simulators/FullstateSimulator.cpp b/src/Qir/Runtime/lib/Simulators/FullstateSimulator.cpp index 93836936317..dc526c4a303 100644 --- a/src/Qir/Runtime/lib/Simulators/FullstateSimulator.cpp +++ b/src/Qir/Runtime/lib/Simulators/FullstateSimulator.cpp @@ -158,13 +158,15 @@ namespace Quantum void DumpState() { std::cout << "*********************" << std::endl; - this->GetState([](size_t idx, double re, double im) { - if (!Close(re, 0.0) || !Close(im, 0.0)) + this->GetState( + [](size_t idx, double re, double im) { - std::cout << "|" << std::bitset<8>(idx) << ">: " << re << "+" << im << "i" << std::endl; - } - return true; - }); + if (!Close(re, 0.0) || !Close(im, 0.0)) + { + std::cout << "|" << std::bitset<8>(idx) << ">: " << re << "+" << im << "i" << std::endl; + } + return true; + }); std::cout << "*********************" << std::endl; } @@ -541,7 +543,8 @@ namespace Quantum private: TDumpToLocationCallback const dumpToLocationCallback = [](size_t idx, double re, double im, - TDumpLocation location) -> bool { + TDumpLocation location) -> bool + { std::ostream& outStream = *reinterpret_cast(location); if (!Close(re, 0.0) || !Close(im, 0.0)) diff --git a/src/Qir/Runtime/prerequisites.ps1 b/src/Qir/Runtime/prerequisites.ps1 index 0452c936612..e1b06c24f6d 100644 --- a/src/Qir/Runtime/prerequisites.ps1 +++ b/src/Qir/Runtime/prerequisites.ps1 @@ -8,7 +8,7 @@ if ($Env:ENABLE_QIRRUNTIME -ne "false") { if (!(Get-Command clang -ErrorAction SilentlyContinue) -or ` !(Get-Command clang-format -ErrorAction SilentlyContinue) -or ` (Test-Path Env:/AGENT_OS)) { - choco install llvm --version=11.1.0 --allow-downgrade + choco install llvm --version=13.0.0 --allow-downgrade Write-Host "##vso[task.setvariable variable=PATH;]$($env:SystemDrive)\Program Files\LLVM\bin;$Env:PATH" } if (!(Get-Command ninja -ErrorAction SilentlyContinue)) { @@ -28,12 +28,21 @@ if ($Env:ENABLE_QIRRUNTIME -ne "false") { brew install clang-format } } else { + $needClang = !(Get-Command clang-13 -ErrorAction SilentlyContinue) if (Get-Command sudo -ErrorAction SilentlyContinue) { + if ($needClang) { + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - + sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" + } sudo apt update - sudo apt-get install -y ninja-build clang-11 clang-tidy-11 clang-format-11 + sudo apt-get install -y ninja-build clang-13 clang-tidy-13 clang-format-13 } else { + if ($needClang) { + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add - + add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" + } apt update - apt-get install -y ninja-build clang-11 clang-tidy-11 clang-format-11 + apt-get install -y ninja-build clang-13 clang-tidy-13 clang-format-13 } } } diff --git a/src/Qir/Runtime/unittests/QirRuntimeTests.cpp b/src/Qir/Runtime/unittests/QirRuntimeTests.cpp index 09a0892d770..6b29ac9e5cf 100644 --- a/src/Qir/Runtime/unittests/QirRuntimeTests.cpp +++ b/src/Qir/Runtime/unittests/QirRuntimeTests.cpp @@ -126,7 +126,7 @@ TEST_CASE("Arrays: one dimensional", "[qir_support]") TEST_CASE("Arrays: multiple dimensions", "[qir_support]") { - const size_t count = 5 * 3 * 4; // 60 + const size_t count = (size_t)(5 * 3 * 4); // 60 QirArray* a = __quantum__rt__array_create(sizeof(int), 3, (int64_t)5, (int64_t)3, (int64_t)4); REQUIRE(__quantum__rt__array_get_dim(a) == 3); REQUIRE(__quantum__rt__array_get_size(a, 0) == 5); diff --git a/src/Qir/Tests/FullstateSimulator/FullstateSimulatorTests.cpp b/src/Qir/Tests/FullstateSimulator/FullstateSimulatorTests.cpp index 65ec0e740e5..5bcc353ec39 100644 --- a/src/Qir/Tests/FullstateSimulator/FullstateSimulatorTests.cpp +++ b/src/Qir/Tests/FullstateSimulator/FullstateSimulatorTests.cpp @@ -346,45 +346,49 @@ TEST_CASE("Fullstate simulator: get qubit state of Bell state", "[fullstate_simu iqa->ControlledX(1, &qs[0], qs[1]); // 1/sqrt(2)(|00> + |11>)x|0> - dynamic_cast(sim.get())->GetState([](size_t idx, double re, double im) { - norm += re * re + im * im; - REQUIRE(idx < 4); - switch (idx) + dynamic_cast(sim.get())->GetState( + [](size_t idx, double re, double im) { - case 0: - case 3: - REQUIRE((1 / sqrt(2.0) == Approx(re).epsilon(0.0001))); - REQUIRE(im == 0.0); - break; - default: - REQUIRE(re == 0.0); - REQUIRE(im == 0.0); - break; - } - return idx < 3; // the last qubit is in separable |0> state - }); + norm += re * re + im * im; + REQUIRE(idx < 4); + switch (idx) + { + case 0: + case 3: + REQUIRE((1 / sqrt(2.0) == Approx(re).epsilon(0.0001))); + REQUIRE(im == 0.0); + break; + default: + REQUIRE(re == 0.0); + REQUIRE(im == 0.0); + break; + } + return idx < 3; // the last qubit is in separable |0> state + }); REQUIRE(1.0 == Approx(norm).epsilon(0.0001)); norm = 0.0; iqa->Y(qs[2]); // 1/sqrt(2)(|00> + |11>)xi|1> - dynamic_cast(sim.get())->GetState([](size_t idx, double re, double im) { - norm += re * re + im * im; - switch (idx) + dynamic_cast(sim.get())->GetState( + [](size_t idx, double re, double im) { - case 4: - case 7: - REQUIRE(re == 0.0); - REQUIRE(1 / sqrt(2.0) == Approx(im).epsilon(0.0001)); - break; - default: - REQUIRE(re == 0.0); - REQUIRE(im == 0.0); - break; - } - return true; // get full state - }); + norm += re * re + im * im; + switch (idx) + { + case 4: + case 7: + REQUIRE(re == 0.0); + REQUIRE(1 / sqrt(2.0) == Approx(im).epsilon(0.0001)); + break; + default: + REQUIRE(re == 0.0); + REQUIRE(im == 0.0); + break; + } + return true; // get full state + }); REQUIRE(1.0 == Approx(norm).epsilon(0.0001)); norm = 0.0; diff --git a/src/Qir/Tools/Microsoft.Quantum.Qir.Runtime.Tools.csproj b/src/Qir/Tools/Microsoft.Quantum.Qir.Runtime.Tools.csproj index 4c7849ae217..aae88451aef 100644 --- a/src/Qir/Tools/Microsoft.Quantum.Qir.Runtime.Tools.csproj +++ b/src/Qir/Tools/Microsoft.Quantum.Qir.Runtime.Tools.csproj @@ -36,7 +36,7 @@ - + diff --git a/src/Qir/check-sources-formatted.ps1 b/src/Qir/check-sources-formatted.ps1 index 39a573c44c0..015ca2a64ef 100644 --- a/src/Qir/check-sources-formatted.ps1 +++ b/src/Qir/check-sources-formatted.ps1 @@ -14,7 +14,7 @@ if (-not $IsMacOS) { # We do not control the clang-format version on MacOS, an $clangFormatCommand = "clang-format" if(($IsLinux) -or ((Test-Path Env:/AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Lin")))) { - $script:clangFormatCommand = "clang-format-11" + $script:clangFormatCommand = "clang-format-13" } $OldErrorActionPreference = $ErrorActionPreference diff --git a/src/Qir/microsoft-quantum-qir-runtime-sys/build.rs b/src/Qir/microsoft-quantum-qir-runtime-sys/build.rs index 287da25af7c..2b8b169a2d1 100644 --- a/src/Qir/microsoft-quantum-qir-runtime-sys/build.rs +++ b/src/Qir/microsoft-quantum-qir-runtime-sys/build.rs @@ -45,12 +45,12 @@ fn compile_runtime_libraries(path_to_runtime_src: &str) -> Result<(), Box Result<(), Box>{ if cfg!(target_os = "linux") { let mut c_cfg = cc::Build::new(); - let clang_11 = which::which("clang-11")?; + let clang_11 = which::which("clang-13")?; c_cfg.compiler(clang_11); config.init_c_cfg(c_cfg); let mut cxx_cfg = cc::Build::new(); - let clangpp_11 = which::which("clang++-11")?; + let clangpp_11 = which::which("clang++-13")?; cxx_cfg.compiler(clangpp_11); config.init_cxx_cfg(cxx_cfg); } else if cfg!(target_os = "windows") { diff --git a/src/Qir/qir-utils.ps1 b/src/Qir/qir-utils.ps1 index 612c19b9246..16988d97a86 100644 --- a/src/Qir/qir-utils.ps1 +++ b/src/Qir/qir-utils.ps1 @@ -44,9 +44,9 @@ function Build-CMakeProject { } elseif (($IsLinux) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Lin")))) { Write-Host "On Linux build $Name using Clang" - $CMAKE_C_COMPILER = "-DCMAKE_C_COMPILER=clang-11" - $CMAKE_CXX_COMPILER = "-DCMAKE_CXX_COMPILER=clang++-11" - $clangTidy = "-DCMAKE_CXX_CLANG_TIDY=clang-tidy-11" + $CMAKE_C_COMPILER = "-DCMAKE_C_COMPILER=clang-13" + $CMAKE_CXX_COMPILER = "-DCMAKE_CXX_COMPILER=clang++-13" + $clangTidy = "-DCMAKE_CXX_CLANG_TIDY=clang-tidy-13" } elseif (($IsWindows) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Win")))) { Write-Host "On Windows build $Name using Clang" diff --git a/src/Simulation/AutoSubstitution/Microsoft.Quantum.AutoSubstitution.csproj b/src/Simulation/AutoSubstitution/Microsoft.Quantum.AutoSubstitution.csproj index 917706b04be..a9df8cf681a 100644 --- a/src/Simulation/AutoSubstitution/Microsoft.Quantum.AutoSubstitution.csproj +++ b/src/Simulation/AutoSubstitution/Microsoft.Quantum.AutoSubstitution.csproj @@ -19,7 +19,7 @@ - + diff --git a/src/Simulation/EntryPointDriver.Tests/Tests.Microsoft.Quantum.EntryPointDriver.fsproj b/src/Simulation/EntryPointDriver.Tests/Tests.Microsoft.Quantum.EntryPointDriver.fsproj index 125157d80e8..f811abaf62f 100644 --- a/src/Simulation/EntryPointDriver.Tests/Tests.Microsoft.Quantum.EntryPointDriver.fsproj +++ b/src/Simulation/EntryPointDriver.Tests/Tests.Microsoft.Quantum.EntryPointDriver.fsproj @@ -23,7 +23,7 @@ - + diff --git a/src/Simulation/Native/build-native-simulator.ps1 b/src/Simulation/Native/build-native-simulator.ps1 index 75f7043fc68..d71228e4ce5 100644 --- a/src/Simulation/Native/build-native-simulator.ps1 +++ b/src/Simulation/Native/build-native-simulator.ps1 @@ -62,7 +62,7 @@ if (($IsWindows) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("W } elseif (($IsLinux) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Lin")))) { - cmake -D BUILD_SHARED_LIBS:BOOL="1" -D CMAKE_C_COMPILER=clang-11 -D CMAKE_CXX_COMPILER=clang++-11 ` + cmake -D BUILD_SHARED_LIBS:BOOL="1" -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ ` -D CMAKE_C_FLAGS_DEBUG="$SANITIZE_FLAGS" ` -D CMAKE_CXX_FLAGS_DEBUG="$SANITIZE_FLAGS" ` -D CMAKE_BUILD_TYPE="$Env:BUILD_CONFIGURATION" .. diff --git a/src/Simulation/Native/prerequisites.ps1 b/src/Simulation/Native/prerequisites.ps1 index 935e7d4caaf..1e00fed0e00 100644 --- a/src/Simulation/Native/prerequisites.ps1 +++ b/src/Simulation/Native/prerequisites.ps1 @@ -7,7 +7,7 @@ if (($IsMacOS) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Dar } elseif (($IsWindows) -or ((Test-Path Env:/AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Win")))) { if (!(Get-Command clang -ErrorAction SilentlyContinue) -or ` (Test-Path Env:/AGENT_OS)) { - choco install llvm --version=11.1.0 --allow-downgrade + choco install llvm --version=13.0.0 --allow-downgrade Write-Host "##vso[task.setvariable variable=PATH;]$($env:SystemDrive)\Program Files\LLVM\bin;$Env:PATH" } if (!(Get-Command ninja -ErrorAction SilentlyContinue)) { @@ -19,12 +19,21 @@ if (($IsMacOS) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Dar refreshenv } else { + $needClang = !(Get-Command clang-13 -ErrorAction SilentlyContinue) if (Get-Command sudo -ErrorAction SilentlyContinue) { + if ($needClang) { + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - + sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" + } sudo apt update - sudo apt-get install -y clang-11 + sudo apt-get install -y clang-13 } else { + if ($needClang) { + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add - + add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" + } apt update - apt-get install -y clang-11 + apt-get install -y clang-13 } } diff --git a/src/Xunit/Microsoft.Quantum.Xunit.nuspec b/src/Xunit/Microsoft.Quantum.Xunit.nuspec index 2066e99d582..cfe98f02664 100644 --- a/src/Xunit/Microsoft.Quantum.Xunit.nuspec +++ b/src/Xunit/Microsoft.Quantum.Xunit.nuspec @@ -22,7 +22,7 @@ - +