@@ -1289,6 +1289,30 @@ 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>
1299+ CfiFunctionIndex (It B, It E) : Index(B, E) {}
1300+
1301+ std::set<std::string, std::less<>>::const_iterator begin () const {
1302+ return Index.begin ();
1303+ }
1304+
1305+ std::set<std::string, std::less<>>::const_iterator end () const {
1306+ return Index.end ();
1307+ }
1308+
1309+ template <typename ... Args> void emplace (Args &&...A) {
1310+ Index.emplace (std::forward<Args>(A)...);
1311+ }
1312+
1313+ size_t count (StringRef S) const { return Index.count (S); }
1314+ };
1315+
12921316// / 160 bits SHA1
12931317using ModuleHash = std::array<uint32_t , 5 >;
12941318
@@ -1418,8 +1442,8 @@ class ModuleSummaryIndex {
14181442 // / True if some of the FunctionSummary contains a ParamAccess.
14191443 bool HasParamAccess = false ;
14201444
1421- std::set<std::string, std::less<>> CfiFunctionDefs;
1422- std::set<std::string, std::less<>> CfiFunctionDecls;
1445+ CfiFunctionIndex CfiFunctionDefs;
1446+ CfiFunctionIndex CfiFunctionDecls;
14231447
14241448 // Used in cases where we want to record the name of a global, but
14251449 // don't have the string owned elsewhere (e.g. the Strtab on a module).
@@ -1667,19 +1691,11 @@ class ModuleSummaryIndex {
16671691 return I == OidGuidMap.end () ? 0 : I->second ;
16681692 }
16691693
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- }
1694+ CfiFunctionIndex &cfiFunctionDefs () { return CfiFunctionDefs; }
1695+ const CfiFunctionIndex &cfiFunctionDefs () const { return CfiFunctionDefs; }
16761696
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- }
1697+ CfiFunctionIndex &cfiFunctionDecls () { return CfiFunctionDecls; }
1698+ const CfiFunctionIndex &cfiFunctionDecls () const { return CfiFunctionDecls; }
16831699
16841700 // / Add a global value summary for a value.
16851701 void addGlobalValueSummary (const GlobalValue &GV,
0 commit comments