From 3322354bfcae4ce03675f7597e68d99243d63f69 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 6 Sep 2021 09:10:07 -0700 Subject: [PATCH] [Support] Qualify auto (NFC) Identified with readability-qualified-auto. --- llvm/include/llvm/Support/Allocator.h | 2 +- llvm/include/llvm/Support/Error.h | 4 ++-- llvm/include/llvm/Support/FormatVariadic.h | 2 +- llvm/include/llvm/Support/YAMLTraits.h | 2 +- llvm/lib/Support/SpecialCaseList.cpp | 4 ++-- llvm/lib/Support/TimeProfiler.cpp | 2 +- llvm/lib/Support/VirtualFileSystem.cpp | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h index 245432de..9e8ce4e 100644 --- a/llvm/include/llvm/Support/Allocator.h +++ b/llvm/include/llvm/Support/Allocator.h @@ -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; } diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h index 4708d5b..707e0b9 100644 --- a/llvm/include/llvm/Support/Error.h +++ b/llvm/include/llvm/Support/Error.h @@ -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 { 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"; } diff --git a/llvm/include/llvm/Support/FormatVariadic.h b/llvm/include/llvm/Support/FormatVariadic.h index 094b054..89575f0 100644 --- a/llvm/include/llvm/Support/FormatVariadic.h +++ b/llvm/include/llvm/Support/FormatVariadic.h @@ -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); diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h index 9ac9eb3..bea232e 100644 --- a/llvm/include/llvm/Support/YAMLTraits.h +++ b/llvm/include/llvm/Support/YAMLTraits.h @@ -1641,7 +1641,7 @@ void IO::processKeyWithDefault(const char *Key, Optional &Val, // usually None. bool IsNone = false; if (!outputting()) - if (auto *Node = dyn_cast(((Input *)this)->getCurrentNode())) + if (const auto *Node = dyn_cast(((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(' ') == ""; diff --git a/llvm/lib/Support/SpecialCaseList.cpp b/llvm/lib/Support/SpecialCaseList.cpp index 73f8526..499e5aa 100644 --- a/llvm/lib/Support/SpecialCaseList.cpp +++ b/llvm/lib/Support/SpecialCaseList.cpp @@ -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); diff --git a/llvm/lib/Support/TimeProfiler.cpp b/llvm/lib/Support/TimeProfiler.cpp index 8f2544e..1574212 100644 --- a/llvm/lib/Support/TimeProfiler.cpp +++ b/llvm/lib/Support/TimeProfiler.cpp @@ -273,7 +273,7 @@ void llvm::timeTraceProfilerInitialize(unsigned TimeTraceGranularity, void llvm::timeTraceProfilerCleanup() { delete TimeTraceProfilerInstance; std::lock_guard Lock(Mu); - for (auto TTP : *ThreadTimeTraceProfilerInstances) + for (auto *TTP : *ThreadTimeTraceProfilerInstances) delete TTP; ThreadTimeTraceProfilerInstances->clear(); } diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp index 15bb54e..ac54ff8 100644 --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -442,7 +442,7 @@ std::error_code OverlayFileSystem::isLocal(const Twine &Path, bool &Result) { std::error_code OverlayFileSystem::getRealPath(const Twine &Path, SmallVectorImpl &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; -- 2.7.4