@@ -1289,6 +1289,29 @@ struct TypeIdSummary {
1289
1289
std::map<uint64_t , WholeProgramDevirtResolution> WPDRes;
1290
1290
};
1291
1291
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
+
1292
1315
// / 160 bits SHA1
1293
1316
using ModuleHash = std::array<uint32_t , 5 >;
1294
1317
@@ -1418,8 +1441,8 @@ class ModuleSummaryIndex {
1418
1441
// / True if some of the FunctionSummary contains a ParamAccess.
1419
1442
bool HasParamAccess = false ;
1420
1443
1421
- std::set<std::string, std::less<>> CfiFunctionDefs;
1422
- std::set<std::string, std::less<>> CfiFunctionDecls;
1444
+ CfiFunctionIndex CfiFunctionDefs;
1445
+ CfiFunctionIndex CfiFunctionDecls;
1423
1446
1424
1447
// Used in cases where we want to record the name of a global, but
1425
1448
// don't have the string owned elsewhere (e.g. the Strtab on a module).
@@ -1667,19 +1690,11 @@ class ModuleSummaryIndex {
1667
1690
return I == OidGuidMap.end () ? 0 : I->second ;
1668
1691
}
1669
1692
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; }
1676
1695
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; }
1683
1698
1684
1699
// / Add a global value summary for a value.
1685
1700
void addGlobalValueSummary (const GlobalValue &GV,
0 commit comments