@@ -1289,6 +1289,29 @@ struct TypeIdSummary {
12891289 std::map<uint64_t , WholeProgramDevirtResolution> WPDRes;
12901290};
12911291
1292+ class CfiFunctionIndex {
1293+ std::set<std::string, std::less<>> Index;
1294+
1295+ public:
1296+ CfiFunctionIndex () = default ;
1297+
1298+ template <typename It> CfiFunctionIndex (It B, It E) : Index(B, E) {}
1299+
1300+ std::set<std::string, std::less<>>::const_iterator begin () const {
1301+ return Index.begin ();
1302+ }
1303+
1304+ std::set<std::string, std::less<>>::const_iterator end () const {
1305+ return Index.end ();
1306+ }
1307+
1308+ template <typename ... Args> void emplace (Args &&...A) {
1309+ Index.emplace (std::forward<Args>(A)...);
1310+ }
1311+
1312+ size_t count (StringRef S) const { return Index.count (S); }
1313+ };
1314+
12921315// / 160 bits SHA1
12931316using ModuleHash = std::array<uint32_t , 5 >;
12941317
@@ -1418,8 +1441,8 @@ class ModuleSummaryIndex {
14181441 // / True if some of the FunctionSummary contains a ParamAccess.
14191442 bool HasParamAccess = false ;
14201443
1421- std::set<std::string, std::less<>> CfiFunctionDefs;
1422- std::set<std::string, std::less<>> CfiFunctionDecls;
1444+ CfiFunctionIndex CfiFunctionDefs;
1445+ CfiFunctionIndex CfiFunctionDecls;
14231446
14241447 // Used in cases where we want to record the name of a global, but
14251448 // don't have the string owned elsewhere (e.g. the Strtab on a module).
@@ -1667,19 +1690,11 @@ class ModuleSummaryIndex {
16671690 return I == OidGuidMap.end () ? 0 : I->second ;
16681691 }
16691692
1670- std::set<std::string, std::less<>> &cfiFunctionDefs () {
1671- return CfiFunctionDefs;
1672- }
1673- const std::set<std::string, std::less<>> &cfiFunctionDefs () const {
1674- return CfiFunctionDefs;
1675- }
1693+ CfiFunctionIndex &cfiFunctionDefs () { return CfiFunctionDefs; }
1694+ const CfiFunctionIndex &cfiFunctionDefs () const { return CfiFunctionDefs; }
16761695
1677- std::set<std::string, std::less<>> &cfiFunctionDecls () {
1678- return CfiFunctionDecls;
1679- }
1680- const std::set<std::string, std::less<>> &cfiFunctionDecls () const {
1681- return CfiFunctionDecls;
1682- }
1696+ CfiFunctionIndex &cfiFunctionDecls () { return CfiFunctionDecls; }
1697+ const CfiFunctionIndex &cfiFunctionDecls () const { return CfiFunctionDecls; }
16831698
16841699 // / Add a global value summary for a value.
16851700 void addGlobalValueSummary (const GlobalValue &GV,
0 commit comments