[Support] Qualify auto (NFC)

Identified with readability-qualified-auto.
This commit is contained in:
Kazu Hirata 2021-09-06 09:10:07 -07:00
parent 8883db90d1
commit 3322354bfc
7 changed files with 9 additions and 9 deletions

View File

@ -277,7 +277,7 @@ public:
size_t TotalMemory = 0;
for (auto I = Slabs.begin(), E = Slabs.end(); I != E; ++I)
TotalMemory += computeSlabSize(std::distance(Slabs.begin(), I));
for (auto &PtrAndSize : CustomSizedSlabs)
for (const auto &PtrAndSize : CustomSizedSlabs)
TotalMemory += PtrAndSize.second;
return TotalMemory;
}

View File

@ -313,7 +313,7 @@ private:
}
friend raw_ostream &operator<<(raw_ostream &OS, const Error &E) {
if (auto P = E.getPtr())
if (auto *P = E.getPtr())
P->log(OS);
else
OS << "success";
@ -373,7 +373,7 @@ class ErrorList final : public ErrorInfo<ErrorList> {
public:
void log(raw_ostream &OS) const override {
OS << "Multiple errors:\n";
for (auto &ErrPayload : Payloads) {
for (const auto &ErrPayload : Payloads) {
ErrPayload->log(OS);
OS << "\n";
}

View File

@ -94,7 +94,7 @@ public:
continue;
}
auto W = Adapters[R.Index];
auto *W = Adapters[R.Index];
FmtAlign Align(*W, R.Where, R.Align, R.Pad);
Align.format(S, R.Options);

View File

@ -1641,7 +1641,7 @@ void IO::processKeyWithDefault(const char *Key, Optional<T> &Val,
// usually None.
bool IsNone = false;
if (!outputting())
if (auto *Node = dyn_cast<ScalarNode>(((Input *)this)->getCurrentNode()))
if (const auto *Node = dyn_cast<ScalarNode>(((Input *)this)->getCurrentNode()))
// We use rtrim to ignore possible white spaces that might exist when a
// comment is present on the same line.
IsNone = Node->getRawValue().rtrim(' ') == "<none>";

View File

@ -64,7 +64,7 @@ unsigned SpecialCaseList::Matcher::match(StringRef Query) const {
return It->second;
if (Trigrams.isDefinitelyOut(Query))
return false;
for (auto& RegExKV : RegExes)
for (const auto &RegExKV : RegExes)
if (RegExKV.first->match(Query))
return RegExKV.second;
return 0;
@ -209,7 +209,7 @@ bool SpecialCaseList::inSection(StringRef Section, StringRef Prefix,
unsigned SpecialCaseList::inSectionBlame(StringRef Section, StringRef Prefix,
StringRef Query,
StringRef Category) const {
for (auto &SectionIter : Sections)
for (const auto &SectionIter : Sections)
if (SectionIter.SectionMatcher->match(Section)) {
unsigned Blame =
inSectionBlame(SectionIter.Entries, Prefix, Query, Category);

View File

@ -273,7 +273,7 @@ void llvm::timeTraceProfilerInitialize(unsigned TimeTraceGranularity,
void llvm::timeTraceProfilerCleanup() {
delete TimeTraceProfilerInstance;
std::lock_guard<std::mutex> Lock(Mu);
for (auto TTP : *ThreadTimeTraceProfilerInstances)
for (auto *TTP : *ThreadTimeTraceProfilerInstances)
delete TTP;
ThreadTimeTraceProfilerInstances->clear();
}

View File

@ -442,7 +442,7 @@ std::error_code OverlayFileSystem::isLocal(const Twine &Path, bool &Result) {
std::error_code
OverlayFileSystem::getRealPath(const Twine &Path,
SmallVectorImpl<char> &Output) const {
for (auto &FS : FSList)
for (const auto &FS : FSList)
if (FS->exists(Path))
return FS->getRealPath(Path, Output);
return errc::no_such_file_or_directory;