@@ -619,7 +619,7 @@ namespace {
619
619
std::vector<std::string> uniques;
620
620
std::set<std::string> unique_set (enums.begin (), enums.end ());
621
621
for (const auto &i : enums) {
622
- std::set<std::string>::iterator set_i = unique_set.find (i);
622
+ auto set_i = unique_set.find (i);
623
623
if (set_i != unique_set.end ()) {
624
624
uniques.push_back (i);
625
625
unique_set.erase (set_i);
@@ -665,8 +665,7 @@ namespace {
665
665
OS << type << " " << getUpperName ();
666
666
}
667
667
void writeDeclarations (raw_ostream &OS) const override {
668
- std::vector<std::string>::const_iterator i = uniques.begin (),
669
- e = uniques.end ();
668
+ auto i = uniques.cbegin (), e = uniques.cend ();
670
669
// The last one needs to not have a comma.
671
670
--e;
672
671
@@ -771,8 +770,7 @@ namespace {
771
770
bool isVariadicEnumArg () const override { return true ; }
772
771
773
772
void writeDeclarations (raw_ostream &OS) const override {
774
- std::vector<std::string>::const_iterator i = uniques.begin (),
775
- e = uniques.end ();
773
+ auto i = uniques.cbegin (), e = uniques.cend ();
776
774
// The last one needs to not have a comma.
777
775
--e;
778
776
@@ -958,7 +956,7 @@ namespace {
958
956
}
959
957
960
958
void writeTemplateInstantiation (raw_ostream &OS) const override {
961
- OS << " " << getType () << " *tempInst" << getUpperName ()
959
+ OS << " auto *tempInst" << getUpperName ()
962
960
<< " = new (C, 16) " << getType ()
963
961
<< " [A->" << getLowerName () << " _size()];\n " ;
964
962
OS << " {\n " ;
@@ -1537,7 +1535,7 @@ void EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS) {
1537
1535
}
1538
1536
OS << " , SourceRange Loc = SourceRange()" ;
1539
1537
OS << " ) {\n " ;
1540
- OS << " " << R. getName () << " Attr *A = new (Ctx) " << R.getName ();
1538
+ OS << " auto *A = new (Ctx) " << R.getName ();
1541
1539
OS << " Attr(Loc, Ctx, " ;
1542
1540
for (auto const &ai : Args) {
1543
1541
if (ai->isFake () && !emitFake) continue ;
@@ -1654,7 +1652,7 @@ void EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS) {
1654
1652
OS << " };\n\n " ;
1655
1653
}
1656
1654
1657
- OS << " #endif\n " ;
1655
+ OS << " #endif // LLVM_CLANG_ATTR_CLASSES_INC \n " ;
1658
1656
}
1659
1657
1660
1658
// Emits the class method definitions for attributes.
@@ -1729,7 +1727,7 @@ void EmitClangAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
1729
1727
1730
1728
static void EmitAttrList (raw_ostream &OS, StringRef Class,
1731
1729
const std::vector<Record*> &AttrList) {
1732
- std::vector<Record*>::const_iterator i = AttrList.begin (), e = AttrList.end ();
1730
+ auto i = AttrList.cbegin (), e = AttrList.cend ();
1733
1731
1734
1732
if (i != e) {
1735
1733
// Move the end iterator back to emit the last attribute.
@@ -1881,7 +1879,7 @@ void EmitClangAttrPCHWrite(RecordKeeper &Records, raw_ostream &OS) {
1881
1879
OS << " case attr::" << R.getName () << " : {\n " ;
1882
1880
Args = R.getValueAsListOfDefs (" Args" );
1883
1881
if (R.isSubClassOf (InhClass) || !Args.empty ())
1884
- OS << " const " << R. getName () << " Attr *SA = cast<" << R.getName ()
1882
+ OS << " const auto *SA = cast<" << R.getName ()
1885
1883
<< " Attr>(A);\n " ;
1886
1884
if (R.isSubClassOf (InhClass))
1887
1885
OS << " Record.push_back(SA->isInherited());\n " ;
@@ -2045,9 +2043,7 @@ void EmitClangAttrHasAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
2045
2043
GenerateHasAttrSpellingStringSwitch (Pragma, OS, " Pragma" );
2046
2044
OS << " case AttrSyntax::CXX: {\n " ;
2047
2045
// C++11-style attributes are further split out based on the Scope.
2048
- for (std::map<std::string, std::vector<Record *>>::iterator I = CXX.begin (),
2049
- E = CXX.end ();
2050
- I != E; ++I) {
2046
+ for (auto I = CXX.cbegin (), E = CXX.cend (); I != E; ++I) {
2051
2047
if (I != CXX.begin ())
2052
2048
OS << " else " ;
2053
2049
if (I->first .empty ())
@@ -2197,7 +2193,7 @@ void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS) {
2197
2193
continue ;
2198
2194
}
2199
2195
2200
- OS << " const " << R. getName () << " Attr *A = cast<"
2196
+ OS << " const auto *A = cast<"
2201
2197
<< R.getName () << " Attr>(At);\n " ;
2202
2198
bool TDependent = R.getValueAsBit (" TemplateDependent" );
2203
2199
@@ -2405,7 +2401,7 @@ static std::string GenerateCustomAppertainsTo(const Record &Subject,
2405
2401
// If this code has already been generated, simply return the previous
2406
2402
// instance of it.
2407
2403
static std::set<std::string> CustomSubjectSet;
2408
- std::set<std::string>::iterator I = CustomSubjectSet.find (FnName);
2404
+ auto I = CustomSubjectSet.find (FnName);
2409
2405
if (I != CustomSubjectSet.end ())
2410
2406
return *I;
2411
2407
@@ -2419,7 +2415,7 @@ static std::string GenerateCustomAppertainsTo(const Record &Subject,
2419
2415
}
2420
2416
2421
2417
OS << " static bool " << FnName << " (const Decl *D) {\n " ;
2422
- OS << " if (const " << GetSubjectWithSuffix (Base) << " *S = dyn_cast<" ;
2418
+ OS << " if (const auto *S = dyn_cast<" ;
2423
2419
OS << GetSubjectWithSuffix (Base);
2424
2420
OS << " >(D))\n " ;
2425
2421
OS << " return " << Subject.getValueAsString (" CheckCode" ) << " ;\n " ;
@@ -2519,7 +2515,7 @@ static std::string GenerateLangOptRequirements(const Record &R,
2519
2515
// If this code has already been generated, simply return the previous
2520
2516
// instance of it.
2521
2517
static std::set<std::string> CustomLangOptsSet;
2522
- std::set<std::string>::iterator I = CustomLangOptsSet.find (FnName);
2518
+ auto I = CustomLangOptsSet.find (FnName);
2523
2519
if (I != CustomLangOptsSet.end ())
2524
2520
return *I;
2525
2521
@@ -2582,7 +2578,7 @@ static std::string GenerateTargetRequirements(const Record &Attr,
2582
2578
// If this code has already been generated, simply return the previous
2583
2579
// instance of it.
2584
2580
static std::set<std::string> CustomTargetSet;
2585
- std::set<std::string>::iterator I = CustomTargetSet.find (FnName);
2581
+ auto I = CustomTargetSet.find (FnName);
2586
2582
if (I != CustomTargetSet.end ())
2587
2583
return *I;
2588
2584
@@ -2800,13 +2796,13 @@ void EmitClangAttrDump(RecordKeeper &Records, raw_ostream &OS) {
2800
2796
2801
2797
Args = R.getValueAsListOfDefs (" Args" );
2802
2798
if (!Args.empty ()) {
2803
- OS << " const " << R. getName () << " Attr *SA = cast<" << R.getName ()
2799
+ OS << " const auto *SA = cast<" << R.getName ()
2804
2800
<< " Attr>(A);\n " ;
2805
2801
for (const auto *Arg : Args)
2806
2802
createArgument (*Arg, R.getName ())->writeDump (OS);
2807
2803
2808
- for (auto AI = Args. begin (), AE = Args. end (); AI != AE; ++AI )
2809
- createArgument (** AI, R.getName ())->writeDumpChildren (OS);
2804
+ for (const auto * AI : Args)
2805
+ createArgument (*AI, R.getName ())->writeDumpChildren (OS);
2810
2806
}
2811
2807
OS <<
2812
2808
" break;\n "
0 commit comments