@@ -131,12 +131,12 @@ namespace {
131
131
};
132
132
133
133
struct GroupInfo {
134
- llvm:: StringRef GroupName;
134
+ StringRef GroupName;
135
135
std::vector<const Record*> DiagsInGroup;
136
136
std::vector<std::string> SubGroups;
137
137
unsigned IDNo = 0 ;
138
138
139
- llvm:: SmallVector<const Record *, 1 > Defs;
139
+ SmallVector<const Record *, 1 > Defs;
140
140
141
141
GroupInfo () = default ;
142
142
};
@@ -213,7 +213,7 @@ static void groupDiagnostics(ArrayRef<const Record *> Diags,
213
213
if (IsImplicit)
214
214
continue ;
215
215
216
- llvm:: SMLoc Loc = Def->getLoc ().front ();
216
+ SMLoc Loc = Def->getLoc ().front ();
217
217
if (First) {
218
218
SrcMgr.PrintMessage (Loc, SourceMgr::DK_Error,
219
219
Twine (" group '" ) + Group.first +
@@ -228,7 +228,7 @@ static void groupDiagnostics(ArrayRef<const Record *> Diags,
228
228
if (!cast<DefInit>(Diag->getValueInit (" Group" ))->getDef ()->isAnonymous ())
229
229
continue ;
230
230
231
- llvm:: SMLoc Loc = Diag->getLoc ().front ();
231
+ SMLoc Loc = Diag->getLoc ().front ();
232
232
if (First) {
233
233
SrcMgr.PrintMessage (Loc, SourceMgr::DK_Error,
234
234
Twine (" group '" ) + Group.first +
@@ -247,20 +247,19 @@ static void groupDiagnostics(ArrayRef<const Record *> Diags,
247
247
// ===----------------------------------------------------------------------===//
248
248
249
249
typedef std::vector<const Record *> RecordVec;
250
- typedef llvm:: DenseSet<const Record *> RecordSet;
251
- typedef llvm:: PointerUnion<RecordVec*, RecordSet*> VecOrSet;
250
+ typedef DenseSet<const Record *> RecordSet;
251
+ typedef PointerUnion<RecordVec *, RecordSet *> VecOrSet;
252
252
253
253
namespace {
254
254
class InferPedantic {
255
- typedef llvm::DenseMap<const Record *,
256
- std::pair<unsigned , std::optional<unsigned >>>
255
+ typedef DenseMap<const Record *, std::pair<unsigned , std::optional<unsigned >>>
257
256
GMap;
258
257
259
258
DiagGroupParentMap &DiagGroupParents;
260
259
ArrayRef<const Record *> Diags;
261
260
const std::vector<const Record *> DiagGroups;
262
261
std::map<std::string, GroupInfo> &DiagsInGroup;
263
- llvm:: DenseSet<const Record*> DiagsSet;
262
+ DenseSet<const Record *> DiagsSet;
264
263
GMap GroupCount;
265
264
public:
266
265
InferPedantic (DiagGroupParentMap &DiagGroupParents,
@@ -277,8 +276,7 @@ class InferPedantic {
277
276
278
277
private:
279
278
// / Determine whether a group is a subgroup of another group.
280
- bool isSubGroupOfGroup (const Record *Group,
281
- llvm::StringRef RootGroupName);
279
+ bool isSubGroupOfGroup (const Record *Group, StringRef RootGroupName);
282
280
283
281
// / Determine if the diagnostic is an extension.
284
282
bool isExtension (const Record *Diag);
@@ -295,8 +293,7 @@ class InferPedantic {
295
293
};
296
294
} // end anonymous namespace
297
295
298
- bool InferPedantic::isSubGroupOfGroup (const Record *Group,
299
- llvm::StringRef GName) {
296
+ bool InferPedantic::isSubGroupOfGroup (const Record *Group, StringRef GName) {
300
297
const std::string &GroupName =
301
298
std::string (Group->getValueAsString (" GroupName" ));
302
299
if (GName == GroupName)
@@ -409,8 +406,8 @@ void InferPedantic::compute(VecOrSet DiagsInPedantic,
409
406
410
407
const std::vector<const Record *> &Parents =
411
408
DiagGroupParents.getParents (Group);
412
- bool AllParentsInPedantic = llvm::all_of (
413
- Parents, [&](const Record *R) { return groupInPedantic (R); });
409
+ bool AllParentsInPedantic =
410
+ all_of ( Parents, [&](const Record *R) { return groupInPedantic (R); });
414
411
// If all the parents are in -Wpedantic, this means that this diagnostic
415
412
// group will be indirectly included by -Wpedantic already. In that
416
413
// case, do not add it directly to -Wpedantic. If the group has no
@@ -613,11 +610,12 @@ struct DiagnosticTextBuilder {
613
610
Piece *getSubstitution (SubstitutionPiece *S) const {
614
611
auto It = Substitutions.find (S->Name );
615
612
if (It == Substitutions.end ())
616
- PrintFatalError (" Failed to find substitution with name: " + S->Name );
613
+ llvm::PrintFatalError (" Failed to find substitution with name: " +
614
+ S->Name );
617
615
return It->second .Root ;
618
616
}
619
617
620
- [[noreturn]] void PrintFatalError (llvm:: Twine const &Msg) const {
618
+ [[noreturn]] void PrintFatalError (Twine const &Msg) const {
621
619
assert (EvaluatingRecord && " not evaluating a record?" );
622
620
llvm::PrintFatalError (EvaluatingRecord->getLoc (), Msg);
623
621
}
@@ -1022,8 +1020,8 @@ Piece *DiagnosticTextBuilder::DiagText::parseDiagText(StringRef &Text,
1022
1020
StopAt Stop) {
1023
1021
std::vector<Piece *> Parsed;
1024
1022
1025
- constexpr llvm:: StringLiteral StopSets[] = {" %" , " %|}" , " %|}$" };
1026
- llvm:: StringRef StopSet = StopSets[static_cast <int >(Stop)];
1023
+ constexpr StringLiteral StopSets[] = {" %" , " %|}" , " %|}$" };
1024
+ StringRef StopSet = StopSets[static_cast <int >(Stop)];
1027
1025
1028
1026
while (!Text.empty ()) {
1029
1027
size_t End = (size_t )-2 ;
@@ -1050,7 +1048,7 @@ Piece *DiagnosticTextBuilder::DiagText::parseDiagText(StringRef &Text,
1050
1048
size_t ModLength = Text.find_first_of (" 0123456789{" );
1051
1049
StringRef Modifier = Text.slice (0 , ModLength);
1052
1050
Text = Text.slice (ModLength, StringRef::npos);
1053
- ModifierType ModType = llvm:: StringSwitch<ModifierType>{Modifier}
1051
+ ModifierType ModType = StringSwitch<ModifierType>{Modifier}
1054
1052
.Case (" select" , MT_Select)
1055
1053
.Case (" sub" , MT_Sub)
1056
1054
.Case (" diff" , MT_Diff)
@@ -1227,7 +1225,7 @@ static bool isExemptAtStart(StringRef Text) {
1227
1225
// OBJECT_MODE. However, if there's only a single letter other than "C", we
1228
1226
// do not exempt it so that we catch a case like "A really bad idea" while
1229
1227
// still allowing a case like "C does not allow...".
1230
- if (llvm:: all_of (Text, [](char C) {
1228
+ if (all_of (Text, [](char C) {
1231
1229
return isUpper (C) || isDigit (C) || C == ' +' || C == ' _' ;
1232
1230
}))
1233
1231
return Text.size () > 1 || Text[0 ] == ' C' ;
@@ -1530,11 +1528,11 @@ void clang::EmitClangDiagsDefs(const RecordKeeper &Records, raw_ostream &OS,
1530
1528
// Warning Group Tables generation
1531
1529
// ===----------------------------------------------------------------------===//
1532
1530
1533
- static std::string getDiagCategoryEnum (llvm:: StringRef name) {
1531
+ static std::string getDiagCategoryEnum (StringRef name) {
1534
1532
if (name.empty ())
1535
1533
return " DiagCat_None" ;
1536
- SmallString<256 > enumName = llvm:: StringRef (" DiagCat_" );
1537
- for (llvm:: StringRef::iterator I = name.begin (), E = name.end (); I != E; ++I)
1534
+ SmallString<256 > enumName = StringRef (" DiagCat_" );
1535
+ for (StringRef::iterator I = name.begin (), E = name.end (); I != E; ++I)
1538
1536
enumName += isalnum (*I) ? *I : ' _' ;
1539
1537
return std::string (enumName);
1540
1538
}
@@ -1841,10 +1839,9 @@ void clang::EmitClangDiagsIndexName(const RecordKeeper &Records,
1841
1839
Index.push_back (RecordIndexElement (R));
1842
1840
}
1843
1841
1844
- llvm::sort (Index,
1845
- [](const RecordIndexElement &Lhs, const RecordIndexElement &Rhs) {
1846
- return Lhs.Name < Rhs.Name ;
1847
- });
1842
+ sort (Index, [](const RecordIndexElement &Lhs, const RecordIndexElement &Rhs) {
1843
+ return Lhs.Name < Rhs.Name ;
1844
+ });
1848
1845
1849
1846
for (unsigned i = 0 , e = Index.size (); i != e; ++i) {
1850
1847
const RecordIndexElement &R = Index[i];
@@ -1941,7 +1938,7 @@ void clang::EmitClangDiagDocs(const RecordKeeper &Records, raw_ostream &OS) {
1941
1938
1942
1939
std::vector<const Record *> DiagGroups =
1943
1940
Records.getAllDerivedDefinitions (" DiagGroup" );
1944
- llvm:: sort (DiagGroups, diagGroupBeforeByName);
1941
+ sort (DiagGroups, diagGroupBeforeByName);
1945
1942
1946
1943
DiagGroupParentMap DGParentMap (Records);
1947
1944
@@ -1960,8 +1957,8 @@ void clang::EmitClangDiagDocs(const RecordKeeper &Records, raw_ostream &OS) {
1960
1957
DiagsInPedanticSet.end ());
1961
1958
RecordVec GroupsInPedantic (GroupsInPedanticSet.begin (),
1962
1959
GroupsInPedanticSet.end ());
1963
- llvm:: sort (DiagsInPedantic, beforeThanCompare);
1964
- llvm:: sort (GroupsInPedantic, beforeThanCompare);
1960
+ sort (DiagsInPedantic, beforeThanCompare);
1961
+ sort (GroupsInPedantic, beforeThanCompare);
1965
1962
PedDiags.DiagsInGroup .insert (PedDiags.DiagsInGroup .end (),
1966
1963
DiagsInPedantic.begin (),
1967
1964
DiagsInPedantic.end ());
@@ -2012,7 +2009,7 @@ void clang::EmitClangDiagDocs(const RecordKeeper &Records, raw_ostream &OS) {
2012
2009
OS << " Also controls " ;
2013
2010
2014
2011
bool First = true ;
2015
- llvm:: sort (GroupInfo.SubGroups );
2012
+ sort (GroupInfo.SubGroups );
2016
2013
for (const auto &Name : GroupInfo.SubGroups ) {
2017
2014
if (!First) OS << " , " ;
2018
2015
OS << " `" << (IsRemarkGroup ? " -R" : " -W" ) << Name << " `_" ;
0 commit comments