@@ -153,11 +153,13 @@ static bool diagGroupBeforeByName(const Record *LHS, const Record *RHS) {
153
153
RHS->getValueAsString (" GroupName" );
154
154
}
155
155
156
+ using DiagsInGroupTy = std::map<std::string, GroupInfo, std::less<>>;
157
+
156
158
// / Invert the 1-[0/1] mapping of diags to group into a one to many
157
159
// / mapping of groups to diags in the group.
158
160
static void groupDiagnostics (ArrayRef<const Record *> Diags,
159
161
ArrayRef<const Record *> DiagGroups,
160
- std::map<std::string, GroupInfo> &DiagsInGroup) {
162
+ DiagsInGroupTy &DiagsInGroup) {
161
163
162
164
for (unsigned i = 0 , e = Diags.size (); i != e; ++i) {
163
165
const Record *R = Diags[i];
@@ -256,14 +258,14 @@ class InferPedantic {
256
258
DiagGroupParentMap &DiagGroupParents;
257
259
ArrayRef<const Record *> Diags;
258
260
const std::vector<const Record *> DiagGroups;
259
- std::map<std::string, GroupInfo> &DiagsInGroup;
261
+ DiagsInGroupTy &DiagsInGroup;
260
262
DenseSet<const Record *> DiagsSet;
261
263
GMap GroupCount;
262
264
public:
263
265
InferPedantic (DiagGroupParentMap &DiagGroupParents,
264
266
ArrayRef<const Record *> Diags,
265
267
ArrayRef<const Record *> DiagGroups,
266
- std::map<std::string, GroupInfo> &DiagsInGroup)
268
+ DiagsInGroupTy &DiagsInGroup)
267
269
: DiagGroupParents(DiagGroupParents), Diags(Diags),
268
270
DiagGroups (DiagGroups), DiagsInGroup(DiagsInGroup) {}
269
271
@@ -1426,7 +1428,7 @@ void clang::EmitClangDiagsDefs(const RecordKeeper &Records, raw_ostream &OS,
1426
1428
ArrayRef<const Record *> DiagGroups =
1427
1429
Records.getAllDerivedDefinitions (" DiagGroup" );
1428
1430
1429
- std::map<std::string, GroupInfo> DiagsInGroup;
1431
+ DiagsInGroupTy DiagsInGroup;
1430
1432
groupDiagnostics (Diags, DiagGroups, DiagsInGroup);
1431
1433
1432
1434
DiagCategoryIDMap CategoryIDs (Records);
@@ -1549,7 +1551,7 @@ static std::string getDiagCategoryEnum(StringRef name) {
1549
1551
// / }
1550
1552
// / \endcode
1551
1553
// /
1552
- static void emitDiagSubGroups (std::map<std::string, GroupInfo> &DiagsInGroup,
1554
+ static void emitDiagSubGroups (DiagsInGroupTy &DiagsInGroup,
1553
1555
RecordVec &GroupsInPedantic, raw_ostream &OS) {
1554
1556
OS << " static const int16_t DiagSubGroups[] = {\n "
1555
1557
<< " /* Empty */ -1,\n " ;
@@ -1601,7 +1603,7 @@ static void emitDiagSubGroups(std::map<std::string, GroupInfo> &DiagsInGroup,
1601
1603
// / };
1602
1604
// / \endcode
1603
1605
// /
1604
- static void emitDiagArrays (std::map<std::string, GroupInfo> &DiagsInGroup,
1606
+ static void emitDiagArrays (DiagsInGroupTy &DiagsInGroup,
1605
1607
RecordVec &DiagsInPedantic, raw_ostream &OS) {
1606
1608
OS << " static const int16_t DiagArrays[] = {\n "
1607
1609
<< " /* Empty */ -1,\n " ;
@@ -1653,7 +1655,7 @@ static void emitDiagGroupNames(const StringToOffsetTable &GroupNames,
1653
1655
// / static const char DiagGroupNames[];
1654
1656
// / #endif
1655
1657
// / \endcode
1656
- static void emitAllDiagArrays (std::map<std::string, GroupInfo> &DiagsInGroup,
1658
+ static void emitAllDiagArrays (DiagsInGroupTy &DiagsInGroup,
1657
1659
RecordVec &DiagsInPedantic,
1658
1660
RecordVec &GroupsInPedantic,
1659
1661
const StringToOffsetTable &GroupNames,
@@ -1680,7 +1682,7 @@ static void emitAllDiagArrays(std::map<std::string, GroupInfo> &DiagsInGroup,
1680
1682
// / {/* deprecated */ 1981,/* DiagArray1 */ 348, /* DiagSubGroup3 */ 9},
1681
1683
// / #endif
1682
1684
// / \endcode
1683
- static void emitDiagTable (std::map<std::string, GroupInfo> &DiagsInGroup,
1685
+ static void emitDiagTable (DiagsInGroupTy &DiagsInGroup,
1684
1686
RecordVec &DiagsInPedantic,
1685
1687
RecordVec &GroupsInPedantic,
1686
1688
const StringToOffsetTable &GroupNames,
@@ -1782,7 +1784,7 @@ void clang::EmitClangDiagGroups(const RecordKeeper &Records, raw_ostream &OS) {
1782
1784
ArrayRef<const Record *> DiagGroups =
1783
1785
Records.getAllDerivedDefinitions (" DiagGroup" );
1784
1786
1785
- std::map<std::string, GroupInfo> DiagsInGroup;
1787
+ DiagsInGroupTy DiagsInGroup;
1786
1788
groupDiagnostics (Diags, DiagGroups, DiagsInGroup);
1787
1789
1788
1790
// All extensions are implicitly in the "pedantic" group. Record the
@@ -1856,11 +1858,11 @@ namespace docs {
1856
1858
namespace {
1857
1859
1858
1860
bool isRemarkGroup (const Record *DiagGroup,
1859
- const std::map<std::string, GroupInfo> &DiagsInGroup) {
1861
+ const DiagsInGroupTy &DiagsInGroup) {
1860
1862
bool AnyRemarks = false , AnyNonRemarks = false ;
1861
1863
1862
1864
std::function<void (StringRef)> Visit = [&](StringRef GroupName) {
1863
- auto &GroupInfo = DiagsInGroup.find (std::string ( GroupName) )->second ;
1865
+ auto &GroupInfo = DiagsInGroup.find (GroupName)->second ;
1864
1866
for (const Record *Diag : GroupInfo.DiagsInGroup )
1865
1867
(isRemark (*Diag) ? AnyRemarks : AnyNonRemarks) = true ;
1866
1868
for (const auto &Name : GroupInfo.SubGroups )
@@ -1880,13 +1882,12 @@ std::string getDefaultSeverity(const Record *Diag) {
1880
1882
Diag->getValueAsDef (" DefaultSeverity" )->getValueAsString (" Name" ));
1881
1883
}
1882
1884
1883
- std::set<std::string>
1884
- getDefaultSeverities (const Record *DiagGroup,
1885
- const std::map<std::string, GroupInfo> &DiagsInGroup) {
1885
+ std::set<std::string> getDefaultSeverities (const Record *DiagGroup,
1886
+ const DiagsInGroupTy &DiagsInGroup) {
1886
1887
std::set<std::string> States;
1887
1888
1888
1889
std::function<void (StringRef)> Visit = [&](StringRef GroupName) {
1889
- auto &GroupInfo = DiagsInGroup.find (std::string ( GroupName) )->second ;
1890
+ auto &GroupInfo = DiagsInGroup.find (GroupName)->second ;
1890
1891
for (const Record *Diag : GroupInfo.DiagsInGroup )
1891
1892
States.insert (getDefaultSeverity (Diag));
1892
1893
for (const auto &Name : GroupInfo.SubGroups )
@@ -1940,7 +1941,7 @@ void clang::EmitClangDiagDocs(const RecordKeeper &Records, raw_ostream &OS) {
1940
1941
1941
1942
DiagGroupParentMap DGParentMap (Records);
1942
1943
1943
- std::map<std::string, GroupInfo> DiagsInGroup;
1944
+ DiagsInGroupTy DiagsInGroup;
1944
1945
groupDiagnostics (Diags, DiagGroups, DiagsInGroup);
1945
1946
1946
1947
// Compute the set of diagnostics that are in -Wpedantic.
0 commit comments