[clang] Use DenseMap::keys (NFC)#167831
Merged
kazutakahirata merged 1 commit intollvm:mainfrom Nov 13, 2025
Merged
Conversation
With DenseMap::keys, we don't need to use [[maybe_unused]].
Member
|
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-analysis Author: Kazu Hirata (kazutakahirata) ChangesWith DenseMap::keys, we don't need to use [[maybe_unused]]. Full diff: https://github.com/llvm/llvm-project/pull/167831.diff 2 Files Affected:
diff --git a/clang/include/clang/Analysis/FlowSensitive/StorageLocation.h b/clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
index 5d9a0f702a299..8948428accb97 100644
--- a/clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
+++ b/clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
@@ -131,7 +131,7 @@ class RecordStorageLocation final : public StorageLocation {
<< " on StorageLocation " << this << " of type "
<< getType() << "\n";
llvm::dbgs() << "Existing children:\n";
- for ([[maybe_unused]] auto [Field, Loc] : Children) {
+ for (const auto &Field : Children.keys()) {
llvm::dbgs() << Field->getNameAsString() << "\n";
}
}
diff --git a/clang/lib/Analysis/FlowSensitive/ASTOps.cpp b/clang/lib/Analysis/FlowSensitive/ASTOps.cpp
index 431b1f2038357..7ce6b03fc0e71 100644
--- a/clang/lib/Analysis/FlowSensitive/ASTOps.cpp
+++ b/clang/lib/Analysis/FlowSensitive/ASTOps.cpp
@@ -81,7 +81,7 @@ bool containsSameFields(const FieldSet &Fields,
const RecordStorageLocation::FieldToLoc &FieldLocs) {
if (Fields.size() != FieldLocs.size())
return false;
- for ([[maybe_unused]] auto [Field, Loc] : FieldLocs)
+ for (const auto &Field : FieldLocs.keys())
if (!Fields.contains(cast_or_null<FieldDecl>(Field)))
return false;
return true;
|
Xazax-hun
approved these changes
Nov 13, 2025
tgymnich
approved these changes
Nov 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With DenseMap::keys, we don't need to use [[maybe_unused]].