Skip to content

Conversation

@phoebewang
Copy link
Contributor

@phoebewang phoebewang requested review from RKSimon and rnk November 4, 2025 14:09
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Nov 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 4, 2025

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Phoebe Wang (phoebewang)

Changes

Ref: https://learn.microsoft.com/en-us/cpp/build/reference/vlen?view=msvc-170


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

4 Files Affected:

  • (modified) clang/include/clang/Basic/DiagnosticDriverKinds.td (+3)
  • (modified) clang/include/clang/Driver/Options.td (+4)
  • (modified) clang/lib/Driver/ToolChains/Clang.cpp (+31)
  • (modified) clang/test/Driver/cl-x86-flags.c (+21)
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 83980e3ac35b7..e657abb86d95f 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -207,6 +207,9 @@ def err_drv_amdgpu_ieee_without_no_honor_nans : Error<
   "invalid argument '-mno-amdgpu-ieee' only allowed with relaxed NaN handling">;
 def err_drv_argument_not_allowed_with : Error<
   "invalid argument '%0' not allowed with '%1'">;
+def warn_drv_argument_not_allowed_with : Warning<
+  "invalid argument '%0' not allowed with '%1'">,
+  InGroup<OptionIgnored>;
 def err_drv_cannot_open_randomize_layout_seed_file : Error<
   "cannot read randomize layout seed file '%0'">;
 def err_drv_invalid_version_number : Error<
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 11e81e032d5fc..e271444184e44 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -9218,6 +9218,10 @@ def : CLFlag<"Qscatter-">, Alias<mno_scatter>,
 
 def _SLASH_arch : CLCompileJoined<"arch:">,
   HelpText<"Set architecture for code generation">;
+def _SLASH_vlen : CLCompileJoined<"vlen">,
+  HelpText<"Set vector length for autovectorization and other optimizations">;
+def _SLASH_vlen_default : CLFlag<"vlen">,
+  HelpText<"Set default vector length for autovectorization and other optimizations">;
 
 def _SLASH_M_Group : OptionGroup<"</M group>">, Group<cl_compile_Group>;
 def _SLASH_volatile_Group : OptionGroup<"</volatile group>">,
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 30d3e5293a31b..add34c63d9c24 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -8266,6 +8266,37 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType,
                                                      << "/kernel";
  }
 
+  if (Args.hasArg(options::OPT__SLASH_vlen_default)) {
+    // Override /vlen= options.
+    for (const Arg *A : Args.filtered(options::OPT__SLASH_vlen))
+      A->claim();
+    // Nothing to do for AVX512F/AVX512.
+  } else if (const Arg *A = Args.getLastArg(options::OPT__SLASH_vlen)) {
+    StringRef VLen = A->getValue();
+    llvm::SmallSet<std::string, 4> Arch512 = {"AVX512F", "AVX512"};
+    llvm::SmallSet<std::string, 4> Arch256 = {"AVX", "AVX2"};
+
+    StringRef Arch = Args.getLastArgValue(options::OPT__SLASH_arch);
+    if (Arch != "") {
+      if (VLen == "=512") {
+        if (Arch512.contains(Arch.str()))
+          CmdArgs.push_back("-mprefer-vector-width=512");
+        else
+          D.Diag(diag::warn_drv_argument_not_allowed_with)
+              << "/vlen=512" << std::string("/arch:").append(Arch);
+      } else if (VLen == "=256") {
+        if (Arch512.contains(Arch.str()))
+          CmdArgs.push_back("-mprefer-vector-width=256");
+        else if (!Arch256.contains(Arch.str()))
+          D.Diag(diag::warn_drv_argument_not_allowed_with)
+              << "/vlen=256" << std::string("/arch:").append(Arch);
+      } else {
+          D.Diag(diag::warn_drv_unknown_argument_clang_cl)
+              << std::string("/vlen").append(VLen);
+      }
+    }
+  }
+
   Arg *MostGeneralArg = Args.getLastArg(options::OPT__SLASH_vmg);
   Arg *BestCaseArg = Args.getLastArg(options::OPT__SLASH_vmb);
   if (MostGeneralArg && BestCaseArg)
diff --git a/clang/test/Driver/cl-x86-flags.c b/clang/test/Driver/cl-x86-flags.c
index 89526744c0a49..56cfcb420f4ad 100644
--- a/clang/test/Driver/cl-x86-flags.c
+++ b/clang/test/Driver/cl-x86-flags.c
@@ -133,6 +133,27 @@
 // tune: "-target-cpu" "sandybridge"
 // tune-SAME: "-tune-cpu" "haswell"
 
+// RUN: %clang_cl -m64 -arch:AVX512 -vlen=512 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=vlen512 %s
+// vlen512: "-mprefer-vector-width=512"
+
+// RUN: %clang_cl -m64 -arch:AVX512 -vlen=256 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=vlen256 %s
+// vlen256: "-mprefer-vector-width=256"
+
+// RUN: %clang_cl -m64 -arch:AVX512 -vlen=512 -vlen --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=noprefer %s
+// noprefer-NOT: -mprefer-vector-width
+
+// RUN: %clang_cl -m64 -arch:AVX2 -vlen=512 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx2vlen512 %s
+// avx2vlen512: invalid argument '/vlen=512' not allowed with '/arch:AVX2'
+
+// RUN: %clang_cl -m64 -arch:AVX2 -vlen=256 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx2vlen256 %s
+// avx2vlen256-NOT: invalid argument
+
+// RUN: %clang_cl -m32 -arch:SSE2 -vlen=256 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=sse2vlen256 %s
+// sse2vlen256: invalid argument '/vlen=256' not allowed with '/arch:SSE2'
+
+// RUN: %clang_cl -m64 -arch:AVX -vlen256 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avxvlen256 %s
+// avxvlen256: unknown argument ignored in clang-cl: '/vlen256'
+
 void f(void) {
 }
 

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff origin/main HEAD --extensions cpp,c -- clang/lib/Driver/ToolChains/Clang.cpp clang/test/Driver/cl-x86-flags.c --diff_from_common_commit

⚠️
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing origin/main to the base branch/commit you want to compare against.
⚠️

View the diff from clang-format here.
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index e20963ac2..5d3d4e741 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -8266,29 +8266,29 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType,
                                                      << "/kernel";
  }
 
-  if (const Arg *A = Args.getLastArg(options::OPT__SLASH_vlen,
-                                     options::OPT__SLASH_vlen_EQ_256,
-                                     options::OPT__SLASH_vlen_EQ_512)) {
-    llvm::Triple::ArchType AT = getToolChain().getArch();
-    StringRef Default = AT == llvm::Triple::x86 ? "IA32" : "SSE2";
-    StringRef Arch = Args.getLastArgValue(options::OPT__SLASH_arch, Default);
-
-    if (A->getOption().matches(options::OPT__SLASH_vlen_EQ_512)) {
-      if (Arch == "AVX512F" || Arch == "AVX512")
-        CmdArgs.push_back("-mprefer-vector-width=512");
-      else
-        D.Diag(diag::warn_drv_argument_not_allowed_with)
-            << "/vlen=512" << std::string("/arch:").append(Arch);
-    }
+ if (const Arg *A = Args.getLastArg(options::OPT__SLASH_vlen,
+                                    options::OPT__SLASH_vlen_EQ_256,
+                                    options::OPT__SLASH_vlen_EQ_512)) {
+   llvm::Triple::ArchType AT = getToolChain().getArch();
+   StringRef Default = AT == llvm::Triple::x86 ? "IA32" : "SSE2";
+   StringRef Arch = Args.getLastArgValue(options::OPT__SLASH_arch, Default);
+
+   if (A->getOption().matches(options::OPT__SLASH_vlen_EQ_512)) {
+     if (Arch == "AVX512F" || Arch == "AVX512")
+       CmdArgs.push_back("-mprefer-vector-width=512");
+     else
+       D.Diag(diag::warn_drv_argument_not_allowed_with)
+           << "/vlen=512" << std::string("/arch:").append(Arch);
+   }
 
-    if (A->getOption().matches(options::OPT__SLASH_vlen_EQ_256)) {
-      if (Arch == "AVX512F" || Arch == "AVX512")
-        CmdArgs.push_back("-mprefer-vector-width=256");
-      else if (Arch != "AVX" && Arch != "AVX2")
-        D.Diag(diag::warn_drv_argument_not_allowed_with)
-            << "/vlen=256" << std::string("/arch:").append(Arch);
-    }
-  }
+   if (A->getOption().matches(options::OPT__SLASH_vlen_EQ_256)) {
+     if (Arch == "AVX512F" || Arch == "AVX512")
+       CmdArgs.push_back("-mprefer-vector-width=256");
+     else if (Arch != "AVX" && Arch != "AVX2")
+       D.Diag(diag::warn_drv_argument_not_allowed_with)
+           << "/vlen=256" << std::string("/arch:").append(Arch);
+   }
+ }
 
   Arg *MostGeneralArg = Args.getLastArg(options::OPT__SLASH_vmg);
   Arg *BestCaseArg = Args.getLastArg(options::OPT__SLASH_vmb);

@RKSimon
Copy link
Collaborator

RKSimon commented Nov 4, 2025

[X86][clang-cl] Add CL option /arch

Doesn't this add /vlen ? clang-cl already handles /arch

@phoebewang phoebewang changed the title [X86][clang-cl] Add CL option /arch [X86][clang-cl] Add CL option /vlen Nov 5, 2025
Comment on lines 9221 to 9224
def _SLASH_vlen : CLCompileJoined<"vlen">,
HelpText<"Set vector length for autovectorization and other optimizations">;
def _SLASH_vlen_default : CLFlag<"vlen">,
HelpText<"Set default vector length for autovectorization and other optimizations">;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think these should be _SLASH_vlen (for the default) and _SLASH_vlen_EQ for the one ending in = (and that should be included in the flag spelling.

But, since only two values are allowed, it might be simpler to do something like:

def _SLASH_vlen : CLFLag<"vlen"> ...
def _SLASH_vlen_EQ_256 : CLFLag<"vlen=256"> ...
def _SLASH_vlen_EQ_512 : CLFlag<"vlen=512"> ...

Does Clang provide good diagnostics when passing an -mprefer-vector-width that doesn't fit the target architecture?

If so, could we make _SLASH_vlen_EQ_256 an alias for -mprefer-vector-width=256 and so on, and not have to add any new driver logic at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! No, unfortunately: https://godbolt.org/z/hhvjP8W34

}

if (Args.hasArg(options::OPT__SLASH_vlen_default)) {
// Override /vlen= options.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't the last flag take precedence? For example, in /arch:AVX512 /vlen /vlen=256, shouldn't 256 win? What does MSVC do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, MSVC also takes precedence of the last flag: https://godbolt.org/z/43Ga39WhE

StringRef Arch = Args.getLastArgValue(options::OPT__SLASH_arch);

if (A->getOption().matches(options::OPT__SLASH_vlen_EQ_512)) {
if (Arch512.contains(Arch.str()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since the set is so small, and only used here, I think just open-coding the logic would be easier:

if (Arch == "AVX512" || Arch == "AVX512F")

Same for the Arch256 set below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will add AVX10.1, AVX10.2 soon, but I can change it for now.

llvm::SmallSet<std::string, 4> Arch512 = {"AVX512F", "AVX512"};
llvm::SmallSet<std::string, 4> Arch256 = {"AVX", "AVX2"};

StringRef Arch = Args.getLastArgValue(options::OPT__SLASH_arch);
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if the user didn't pass /arch?
What if they passed -mavx512?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. MSVC has a default value for /arch. We should match it here. -mavx512xxx is a single feature, which is orthogonal to /arch. We don't need to check them.

// RUN: %clang_cl -m64 -arch:AVX512 -vlen=256 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=vlen256 %s
// vlen256: "-mprefer-vector-width=256"

// RUN: %clang_cl -m64 -arch:AVX512 -vlen=512 -vlen --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=noprefer %s
Copy link
Collaborator

Choose a reason for hiding this comment

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

how about novlen instead of noprefer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Collaborator

@zmodem zmodem left a comment

Choose a reason for hiding this comment

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

lgtm

@phoebewang phoebewang merged commit ad7488a into llvm:main Nov 8, 2025
9 of 10 checks passed
@phoebewang phoebewang deleted the vlen branch November 8, 2025 03:28
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 8, 2025

LLVM Buildbot has detected a new failure on builder clang-m68k-linux-cross running on suse-gary-m68k-cross while building clang at step 5 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
...
[135/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Parse/ParseHLSLRootSignatureTest.cpp.o
[136/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/ArenaTest.cpp.o
[137/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Lex/PPCallbacksTest.cpp.o
[138/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Driver/ToolChainTest.cpp.o
[139/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/FormulaTest.cpp.o
[140/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DataflowAnalysisContextTest.cpp.o
[141/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/CloneDetectionTest.cpp.o
[142/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/MacroExpansionContextTest.cpp.o
[143/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/ValueTest.cpp.o
[144/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp.o
FAILED: tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp.o 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/unittests -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Tooling -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googletest/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp.o -MF tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp.o.d -o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp.o -c /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[145/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/APSIntTypeTest.cpp.o
[146/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/CFGDominatorTree.cpp.o
[147/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DebugSupportTest.cpp.o
[148/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DeterminismTest.cpp.o
[149/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/RecordOpsTest.cpp.o
[150/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/SimplifyConstraintsTest.cpp.o
[151/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp.o
[152/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/SmartPointerAccessorCachingTest.cpp.o
[153/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/TestingSupportTest.cpp.o
[154/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/CFGTest.cpp.o
[155/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/AnalyzerOptionsTest.cpp.o
[156/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/CFGMatchSwitchTest.cpp.o
[157/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/SignAnalysisTest.cpp.o
[158/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/MapLatticeTest.cpp.o
[159/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/CachedConstAccessorsLatticeTest.cpp.o
[160/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/LoggerTest.cpp.o
[161/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/ASTOpsTest.cpp.o
[162/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/TransferBranchTest.cpp.o
[163/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/MatchSwitchTest.cpp.o
[164/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp.o
[165/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/IntervalPartitionTest.cpp.o
[166/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/LifetimeSafetyTest.cpp.o
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Analysis/LifetimeSafetyTest.cpp: In instantiation of ‘bool clang::lifetimes::internal::{anonymous}::AreLiveAtImplMatcherP2<Annotation_type, ConfFilter_type>::gmock_Impl<arg_type>::MatchAndExplain(const arg_type&, testing::MatchResultListener*) const [with arg_type = const clang::lifetimes::internal::{anonymous}::OriginsInfo&; Annotation_type = const char*; ConfFilter_type = clang::lifetimes::internal::{anonymous}::LivenessKindFilter]’:
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Analysis/LifetimeSafetyTest.cpp:259:1:   required from here
  259 | MATCHER_P2(AreLiveAtImpl, Annotation, ConfFilter, "") {
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Analysis/LifetimeSafetyTest.cpp:269:19: warning: loop variable ‘<structured bindings>’ creates a copy from type ‘const std::pair<clang::lifetimes::internal::utils::ID<clang::lifetimes::internal::OriginTag>, clang::lifetimes::internal::LivenessKind>’ [-Wrange-loop-construct]
  269 |   for (const auto [OID, ActualConfidence] : ActualLiveSetOpt.value()) {
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Analysis/LifetimeSafetyTest.cpp:269:19: note: use reference type to prevent copying
  269 |   for (const auto [OID, ActualConfidence] : ActualLiveSetOpt.value()) {
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
      |                   &
[167/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp.o
[168/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/BlockEntranceCallbackTest.cpp.o
[169/426] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/TestingSupport.cpp.o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants