[llvm] 3322354 - [Support] Qualify auto (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 6 09:10:19 PDT 2021
Author: Kazu Hirata
Date: 2021-09-06T09:10:07-07:00
New Revision: 3322354bfcae4ce03675f7597e68d99243d63f69
URL: https://github.com/llvm/llvm-project/commit/3322354bfcae4ce03675f7597e68d99243d63f69
DIFF: https://github.com/llvm/llvm-project/commit/3322354bfcae4ce03675f7597e68d99243d63f69.diff
LOG: [Support] Qualify auto (NFC)
Identified with readability-qualified-auto.
Added:
Modified:
llvm/include/llvm/Support/Allocator.h
llvm/include/llvm/Support/Error.h
llvm/include/llvm/Support/FormatVariadic.h
llvm/include/llvm/Support/YAMLTraits.h
llvm/lib/Support/SpecialCaseList.cpp
llvm/lib/Support/TimeProfiler.cpp
llvm/lib/Support/VirtualFileSystem.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h
index 245432debce6..9e8ce4e36197 100644
--- a/llvm/include/llvm/Support/Allocator.h
+++ b/llvm/include/llvm/Support/Allocator.h
@@ -277,7 +277,7 @@ class BumpPtrAllocatorImpl
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 4708d5bd6d57..707e0b98b900 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -313,7 +313,7 @@ class LLVM_NODISCARD Error {
}
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";
}
diff --git a/llvm/include/llvm/Support/FormatVariadic.h b/llvm/include/llvm/Support/FormatVariadic.h
index 094b054f773f..89575f01b717 100644
--- a/llvm/include/llvm/Support/FormatVariadic.h
+++ b/llvm/include/llvm/Support/FormatVariadic.h
@@ -94,7 +94,7 @@ class formatv_object_base {
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 9ac9eb300983..bea232e6e000 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<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>";
diff --git a/llvm/lib/Support/SpecialCaseList.cpp b/llvm/lib/Support/SpecialCaseList.cpp
index 73f852624a69..499e5aaacdac 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 8f2544e9e26d..1574212a0df0 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<std::mutex> 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 15bb54e61817..ac54ff8ce168 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<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;
More information about the llvm-commits
mailing list