Skip to content

Revert "[MC][NFC] Make FeatureKV/SubtargetKV pointers private"#206234

Merged
aengelke merged 1 commit into
mainfrom
revert-206178-users/aengelke/spr/mcnfc-make-featurekvsubtargetkv-pointers-private
Jun 27, 2026
Merged

Revert "[MC][NFC] Make FeatureKV/SubtargetKV pointers private"#206234
aengelke merged 1 commit into
mainfrom
revert-206178-users/aengelke/spr/mcnfc-make-featurekvsubtargetkv-pointers-private

Conversation

@aengelke

Copy link
Copy Markdown
Contributor

Build failures in C++20 mode due to deleted constructor preventing brace initialization.

Reverts #206178

@aengelke aengelke added the skip-precommit-approval PR for CI feedback, not intended for review label Jun 27, 2026
@aengelke aengelke enabled auto-merge (squash) June 27, 2026 09:17
@github-actions

Copy link
Copy Markdown

⚠️ 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,h -- clang/tools/driver/cc1_main.cpp llvm/include/llvm/MC/MCSubtargetInfo.h llvm/lib/MC/MCSubtargetInfo.cpp llvm/lib/Target/AMDGPU/AMDGPURemoveIncompatibleFunctions.cpp llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp mlir/lib/Target/LLVMIR/Transforms/TargetToTargetFeatures.cpp --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/llvm/include/llvm/MC/MCSubtargetInfo.h b/llvm/include/llvm/MC/MCSubtargetInfo.h
index 708de6d98..2fabfc595 100644
--- a/llvm/include/llvm/MC/MCSubtargetInfo.h
+++ b/llvm/include/llvm/MC/MCSubtargetInfo.h
@@ -40,9 +40,7 @@ struct SubtargetFeatureKV {
   FeatureBitArray Implies;              ///< K-V bit mask
 
   /// Compare routine for std::lower_bound
-  bool operator<(StringRef S) const {
-    return StringRef(Key) < S;
-  }
+  bool operator<(StringRef S) const { return StringRef(Key) < S; }
 
   /// Compare routine for std::is_sorted.
   bool operator<(const SubtargetFeatureKV &Other) const {
@@ -60,9 +58,7 @@ struct SubtargetSubTypeKV {
   const MCSchedModel *SchedModel;
 
   /// Compare routine for std::lower_bound
-  bool operator<(StringRef S) const {
-    return StringRef(Key) < S;
-  }
+  bool operator<(StringRef S) const { return StringRef(Key) < S; }
 
   /// Compare routine for std::is_sorted.
   bool operator<(const SubtargetSubTypeKV &Other) const {
diff --git a/llvm/lib/MC/MCSubtargetInfo.cpp b/llvm/lib/MC/MCSubtargetInfo.cpp
index ed263a2b4..ecba74060 100644
--- a/llvm/lib/MC/MCSubtargetInfo.cpp
+++ b/llvm/lib/MC/MCSubtargetInfo.cpp
@@ -28,7 +28,8 @@ static const T *Find(StringRef S, ArrayRef<T> A) {
   // Binary search the array
   auto F = llvm::lower_bound(A, S);
   // If not found then return NULL
-  if (F == A.end() || StringRef(F->Key) != S) return nullptr;
+  if (F == A.end() || StringRef(F->Key) != S)
+    return nullptr;
   // Return the found array item
   return F;
 }

@aengelke aengelke disabled auto-merge June 27, 2026 09:22
@aengelke aengelke merged commit e44103c into main Jun 27, 2026
15 of 19 checks passed
@aengelke aengelke deleted the revert-206178-users/aengelke/spr/mcnfc-make-featurekvsubtargetkv-pointers-private branch June 27, 2026 09:22
aengelke added a commit that referenced this pull request Jun 27, 2026
) (#206237)

Fix C++20 build by adding an explicit constructor. This also permits
making the fields private.

This reapplies #206178.
This reverts commit e44103c.
LouisLu060211 pushed a commit to LouisLu060211/llvm-project that referenced this pull request Jun 30, 2026
…206234)

Build failures in C++20 mode due to deleted constructor preventing brace
initialization.

Reverts llvm#206178
LouisLu060211 pushed a commit to LouisLu060211/llvm-project that referenced this pull request Jun 30, 2026
…#206234) (llvm#206237)

Fix C++20 build by adding an explicit constructor. This also permits
making the fields private.

This reapplies llvm#206178.
This reverts commit e44103c.
maarcosrmz pushed a commit to maarcosrmz/llvm-project that referenced this pull request Jul 1, 2026
…206234)

Build failures in C++20 mode due to deleted constructor preventing brace
initialization.

Reverts llvm#206178
maarcosrmz pushed a commit to maarcosrmz/llvm-project that referenced this pull request Jul 1, 2026
…#206234) (llvm#206237)

Fix C++20 build by adding an explicit constructor. This also permits
making the fields private.

This reapplies llvm#206178.
This reverts commit e44103c.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant