================
@@ -141,20 +143,55 @@ class DarwinSDKInfo {
llvm::DenseMap<VersionTuple, VersionTuple> Mapping;
};
+ // Special versions of hash and equal_to to map triples to system prefixes
+ // ignoring the Arch/SubArch.
+ struct TripleHash {
+ std::size_t operator()(const llvm::Triple &Val) const noexcept {
+ return hash_combine(Val.getVendor(), Val.getOS(), Val.getEnvironment(),
+ Val.getObjectFormat());
+ }
+ };
+ struct TripleEqualTo {
+ constexpr bool operator()(const llvm::Triple &LHS,
+ const llvm::Triple &RHS) const {
+ return (LHS.getVendor() == RHS.getVendor()) &&
+ (LHS.getOS() == RHS.getOS()) &&
+ (LHS.getEnvironment() == RHS.getEnvironment()) &&
+ (LHS.getObjectFormat() == RHS.getObjectFormat());
+ }
+ };
+
DarwinSDKInfo(
VersionTuple Version, VersionTuple MaximumDeploymentTarget,
- llvm::Triple::OSType OS,
+ llvm::Triple Triple,
+ std::unordered_map<llvm::Triple, std::string, TripleHash, TripleEqualTo>
----------------
cyndyishida wrote:
`unordered_map` is generally discouraged in the programmers manual:
https://llvm.org/docs/ProgrammersManual.html#other-map-like-container-options.
Though I suspect the container size would always be generally small. Why did
you pick this container?
If you're ignoring arch, why not just hold on to the env & os type in a
`std::pair` as the key? Wouldn't vendor always be `apple` when using
`DarwinSDKInfo`?
https://github.com/llvm/llvm-project/pull/171970
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits