Skip to content

EquivalenceClasses: Make ECValue public. NFC #139689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ruiling
Copy link
Contributor

@ruiling ruiling commented May 13, 2025

Expose the inner class so that we can explicitly write the type outside the parent class.

Expose the inner class so that we can explicitly write the type outside
the parent class.
@llvmbot
Copy link
Member

llvmbot commented May 13, 2025

@llvm/pr-subscribers-llvm-adt

Author: Ruiling, Song (ruiling)

Changes

Expose the inner class so that we can explicitly write the type outside the parent class.


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

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/EquivalenceClasses.h (+2)
diff --git a/llvm/include/llvm/ADT/EquivalenceClasses.h b/llvm/include/llvm/ADT/EquivalenceClasses.h
index fed012ce56005..b1009f8b49992 100644
--- a/llvm/include/llvm/ADT/EquivalenceClasses.h
+++ b/llvm/include/llvm/ADT/EquivalenceClasses.h
@@ -60,6 +60,7 @@ namespace llvm {
 ///   5 1 2
 ///
 template <class ElemTy> class EquivalenceClasses {
+public:
   /// ECValue - The EquivalenceClasses data structure is just a set of these.
   /// Each of these represents a relation for a value.  First it stores the
   /// value itself. Next, it provides a "next pointer", which is used to
@@ -122,6 +123,7 @@ template <class ElemTy> class EquivalenceClasses {
     }
   };
 
+private:
   /// TheMapping - This implicitly provides a mapping from ElemTy values to the
   /// ECValues, it just keeps the key as part of the value.
   DenseMap<ElemTy, ECValue *> TheMapping;

Copy link
Contributor

@fhahn fhahn left a comment

Choose a reason for hiding this comment

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

Can you share why this is needed? ECValue is intentionally not exposed publicly as it is an internal implementation detail

@arsenm
Copy link
Contributor

arsenm commented May 13, 2025

It's directly referenced in public members so I don't see how it can't be public

@ruiling
Copy link
Contributor Author

ruiling commented May 13, 2025

Can you share why this is needed? ECValue is intentionally not exposed publicly as it is an internal implementation detail

See the discussion at #137784 (comment). Using explicit type EquivalenceClasses<SUnit *>::ECValue * is clearer and it depends on making the inner class public.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants