Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

The argument_type and result_type type aliases in std::hash are
deprecated in C++17 and removed in C++20. This patch aligns two
specializations of ours with the C++ standard.

The argument_type and result_type type aliases in std::hash are
deprecated in C++17 and removed in C++20.  This patch aligns two
specializations of ours with the C++ standard.
@llvmbot
Copy link
Member

llvmbot commented Oct 26, 2025

@llvm/pr-subscribers-debuginfo

Author: Kazu Hirata (kazutakahirata)

Changes

The argument_type and result_type type aliases in std::hash are
deprecated in C++17 and removed in C++20. This patch aligns two
specializations of ours with the C++ standard.


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

2 Files Affected:

  • (modified) llvm/include/llvm/DebugInfo/PDB/PDBTypes.h (+1-4)
  • (modified) llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp (+1-4)
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h b/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h
index a64a2e888e9b9..7af2ff1290abe 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBTypes.h
@@ -600,10 +600,7 @@ struct Variant {
 namespace std {
 
 template <> struct hash<llvm::pdb::PDB_SymType> {
-  using argument_type = llvm::pdb::PDB_SymType;
-  using result_type = std::size_t;
-
-  result_type operator()(const argument_type &Arg) const {
+  std::size_t operator()(const llvm::pdb::PDB_SymType &Arg) const {
     return std::hash<int>()(static_cast<int>(Arg));
   }
 };
diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index 93ae5483dedbb..7bef3a8f4d3ff 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -86,10 +86,7 @@ template <> struct llvm::DenseMapInfo<VariableID> {
 using VarLocInsertPt = PointerUnion<const Instruction *, const DbgRecord *>;
 
 template <> struct std::hash<VarLocInsertPt> {
-  using argument_type = VarLocInsertPt;
-  using result_type = std::size_t;
-
-  result_type operator()(const argument_type &Arg) const {
+  std::size_t operator()(const VarLocInsertPt &Arg) const {
     return std::hash<void *>()(Arg.getOpaqueValue());
   }
 };

@kazutakahirata kazutakahirata merged commit 6cb942c into llvm:main Oct 26, 2025
13 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20251026_argument_type_result_type branch October 26, 2025 22:20
varun-r-mallya pushed a commit to varun-r-mallya/llvm-project that referenced this pull request Oct 27, 2025
…165167)

The argument_type and result_type type aliases in std::hash are
deprecated in C++17 and removed in C++20.  This patch aligns two
specializations of ours with the C++ standard.
dvbuka pushed a commit to dvbuka/llvm-project that referenced this pull request Oct 27, 2025
…165167)

The argument_type and result_type type aliases in std::hash are
deprecated in C++17 and removed in C++20.  This patch aligns two
specializations of ours with the C++ standard.
Lukacma pushed a commit to Lukacma/llvm-project that referenced this pull request Oct 29, 2025
…165167)

The argument_type and result_type type aliases in std::hash are
deprecated in C++17 and removed in C++20.  This patch aligns two
specializations of ours with the C++ standard.
aokblast pushed a commit to aokblast/llvm-project that referenced this pull request Oct 30, 2025
…165167)

The argument_type and result_type type aliases in std::hash are
deprecated in C++17 and removed in C++20.  This patch aligns two
specializations of ours with the C++ standard.
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.

3 participants