@@ -1088,26 +1088,11 @@ bool DataReader::hasMemData() {
1088
1088
1089
1089
std::error_code DataReader::parseInNoLBRMode () {
1090
1090
auto GetOrCreateFuncEntry = [&](StringRef Name) {
1091
- auto I = NamesToBasicSamples.find (Name);
1092
- if (I == NamesToBasicSamples.end ()) {
1093
- bool Success;
1094
- std::tie (I, Success) = NamesToBasicSamples.insert (std::make_pair (
1095
- Name, FuncBasicSampleData (Name, FuncBasicSampleData::ContainerTy ())));
1096
-
1097
- assert (Success && " unexpected result of insert" );
1098
- }
1099
- return I;
1091
+ return NamesToBasicSamples.try_emplace (Name, Name).first ;
1100
1092
};
1101
1093
1102
1094
auto GetOrCreateFuncMemEntry = [&](StringRef Name) {
1103
- auto I = NamesToMemEvents.find (Name);
1104
- if (I == NamesToMemEvents.end ()) {
1105
- bool Success;
1106
- std::tie (I, Success) = NamesToMemEvents.insert (
1107
- std::make_pair (Name, FuncMemData (Name, FuncMemData::ContainerTy ())));
1108
- assert (Success && " unexpected result of insert" );
1109
- }
1110
- return I;
1095
+ return NamesToMemEvents.try_emplace (Name, Name).first ;
1111
1096
};
1112
1097
1113
1098
while (hasBranchData ()) {
@@ -1151,26 +1136,11 @@ std::error_code DataReader::parseInNoLBRMode() {
1151
1136
1152
1137
std::error_code DataReader::parse () {
1153
1138
auto GetOrCreateFuncEntry = [&](StringRef Name) {
1154
- auto I = NamesToBranches.find (Name);
1155
- if (I == NamesToBranches.end ()) {
1156
- bool Success;
1157
- std::tie (I, Success) = NamesToBranches.insert (std::make_pair (
1158
- Name, FuncBranchData (Name, FuncBranchData::ContainerTy (),
1159
- FuncBranchData::ContainerTy ())));
1160
- assert (Success && " unexpected result of insert" );
1161
- }
1162
- return I;
1139
+ return NamesToBranches.try_emplace (Name, Name).first ;
1163
1140
};
1164
1141
1165
1142
auto GetOrCreateFuncMemEntry = [&](StringRef Name) {
1166
- auto I = NamesToMemEvents.find (Name);
1167
- if (I == NamesToMemEvents.end ()) {
1168
- bool Success;
1169
- std::tie (I, Success) = NamesToMemEvents.insert (
1170
- std::make_pair (Name, FuncMemData (Name, FuncMemData::ContainerTy ())));
1171
- assert (Success && " unexpected result of insert" );
1172
- }
1173
- return I;
1143
+ return NamesToMemEvents.try_emplace (Name, Name).first ;
1174
1144
};
1175
1145
1176
1146
Col = 0 ;
0 commit comments