[clang-tools-extra] 48ef912 - [VFS] Avoid <stack> include (NFC)
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 21 06:17:50 PDT 2024
Author: Nikita Popov
Date: 2024-06-21T15:17:41+02:00
New Revision: 48ef912e2b32798b704af242e551a7090102c750
URL: https://github.com/llvm/llvm-project/commit/48ef912e2b32798b704af242e551a7090102c750
DIFF: https://github.com/llvm/llvm-project/commit/48ef912e2b32798b704af242e551a7090102c750.diff
LOG: [VFS] Avoid <stack> include (NFC)
Directly use a vector instead of wrapping it in a stack, like we
do in most places.
Added:
Modified:
clang-tools-extra/clang-tidy/abseil/RedundantStrcatCallsCheck.cpp
clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp
clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
clang-tools-extra/clangd/Selection.h
clang/lib/Sema/SemaAPINotes.cpp
clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
clang/unittests/Support/TimeProfilerTest.cpp
lldb/include/lldb/Target/StackFrameRecognizer.h
llvm/include/llvm/Support/VirtualFileSystem.h
llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
llvm/lib/Support/VirtualFileSystem.cpp
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/abseil/RedundantStrcatCallsCheck.cpp b/clang-tools-extra/clang-tidy/abseil/RedundantStrcatCallsCheck.cpp
index fafb029e7de1b..04ca006143503 100644
--- a/clang-tools-extra/clang-tidy/abseil/RedundantStrcatCallsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/abseil/RedundantStrcatCallsCheck.cpp
@@ -9,6 +9,7 @@
#include "RedundantStrcatCallsCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include <deque>
using namespace clang::ast_matchers;
diff --git a/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp
index a64c9b2905ca1..01276af6c7d8f 100644
--- a/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp
@@ -12,6 +12,7 @@
#include "clang/Lex/MacroArgs.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
+#include <stack>
namespace clang::tidy::bugprone {
diff --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
index 5bec7966a9c3a..85c80eb482efb 100644
--- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
+++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
@@ -30,6 +30,7 @@
#include <atomic>
#include <chrono>
#include <condition_variable>
+#include <deque>
#include <mutex>
#include <optional>
#include <string>
diff --git a/clang-tools-extra/clangd/Selection.h b/clang-tools-extra/clangd/Selection.h
index f80ee83c4b94c..cb40c6d403487 100644
--- a/clang-tools-extra/clangd/Selection.h
+++ b/clang-tools-extra/clangd/Selection.h
@@ -45,6 +45,7 @@
#include "clang/AST/PrettyPrinter.h"
#include "clang/Tooling/Syntax/Tokens.h"
#include "llvm/ADT/SmallVector.h"
+#include <stack>
namespace clang {
namespace clangd {
diff --git a/clang/lib/Sema/SemaAPINotes.cpp b/clang/lib/Sema/SemaAPINotes.cpp
index bc1628f5b7163..d535cb35cfbc8 100644
--- a/clang/lib/Sema/SemaAPINotes.cpp
+++ b/clang/lib/Sema/SemaAPINotes.cpp
@@ -18,6 +18,7 @@
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/SemaObjC.h"
#include "clang/Sema/SemaSwift.h"
+#include <stack>
using namespace clang;
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index 487a3bd16b674..4ff4f7de425ca 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -59,6 +59,7 @@
#include <deque>
#include <memory>
#include <optional>
+#include <stack>
#include <string>
#include <utility>
diff --git a/clang/unittests/Support/TimeProfilerTest.cpp b/clang/unittests/Support/TimeProfilerTest.cpp
index 97fdbb7232b13..5f3950ff033f1 100644
--- a/clang/unittests/Support/TimeProfilerTest.cpp
+++ b/clang/unittests/Support/TimeProfilerTest.cpp
@@ -12,6 +12,7 @@
#include "llvm/Support/JSON.h"
#include "llvm/Support/TimeProfiler.h"
+#include <stack>
#include "gtest/gtest.h"
diff --git a/lldb/include/lldb/Target/StackFrameRecognizer.h b/lldb/include/lldb/Target/StackFrameRecognizer.h
index 5e8e12b2a4e96..e9ac2750192ef 100644
--- a/lldb/include/lldb/Target/StackFrameRecognizer.h
+++ b/lldb/include/lldb/Target/StackFrameRecognizer.h
@@ -17,6 +17,7 @@
#include "lldb/lldb-private-forward.h"
#include "lldb/lldb-public.h"
+#include <deque>
#include <optional>
#include <vector>
diff --git a/llvm/include/llvm/Support/VirtualFileSystem.h b/llvm/include/llvm/Support/VirtualFileSystem.h
index a1e38de74dfcc..f7cfcd4058e72 100644
--- a/llvm/include/llvm/Support/VirtualFileSystem.h
+++ b/llvm/include/llvm/Support/VirtualFileSystem.h
@@ -31,7 +31,6 @@
#include <ctime>
#include <memory>
#include <optional>
-#include <stack>
#include <string>
#include <system_error>
#include <utility>
@@ -219,7 +218,7 @@ namespace detail {
/// Keeps state for the recursive_directory_iterator.
struct RecDirIterState {
- std::stack<directory_iterator, std::vector<directory_iterator>> Stack;
+ std::vector<directory_iterator> Stack;
bool HasNoPushRequest = false;
};
@@ -242,8 +241,8 @@ class recursive_directory_iterator {
/// Equivalent to operator++, with an error code.
recursive_directory_iterator &increment(std::error_code &EC);
- const directory_entry &operator*() const { return *State->Stack.top(); }
- const directory_entry *operator->() const { return &*State->Stack.top(); }
+ const directory_entry &operator*() const { return *State->Stack.back(); }
+ const directory_entry *operator->() const { return &*State->Stack.back(); }
bool operator==(const recursive_directory_iterator &Other) const {
return State == Other.State; // identity
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index e2b0dd3ebcb33..21ce0ac17d618 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -37,6 +37,7 @@
#include <map>
#include <memory>
#include <optional>
+#include <stack>
#include <string>
#include <system_error>
#include <utility>
diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp
index f9c15bf7809eb..ce2bf2b4193a5 100644
--- a/llvm/lib/Support/VirtualFileSystem.cpp
+++ b/llvm/lib/Support/VirtualFileSystem.cpp
@@ -2913,30 +2913,31 @@ vfs::recursive_directory_iterator::recursive_directory_iterator(
directory_iterator I = FS->dir_begin(Path, EC);
if (I != directory_iterator()) {
State = std::make_shared<detail::RecDirIterState>();
- State->Stack.push(I);
+ State->Stack.push_back(I);
}
}
vfs::recursive_directory_iterator &
recursive_directory_iterator::increment(std::error_code &EC) {
assert(FS && State && !State->Stack.empty() && "incrementing past end");
- assert(!State->Stack.top()->path().empty() && "non-canonical end iterator");
+ assert(!State->Stack.back()->path().empty() && "non-canonical end iterator");
vfs::directory_iterator End;
if (State->HasNoPushRequest)
State->HasNoPushRequest = false;
else {
- if (State->Stack.top()->type() == sys::fs::file_type::directory_file) {
- vfs::directory_iterator I = FS->dir_begin(State->Stack.top()->path(), EC);
+ if (State->Stack.back()->type() == sys::fs::file_type::directory_file) {
+ vfs::directory_iterator I =
+ FS->dir_begin(State->Stack.back()->path(), EC);
if (I != End) {
- State->Stack.push(I);
+ State->Stack.push_back(I);
return *this;
}
}
}
- while (!State->Stack.empty() && State->Stack.top().increment(EC) == End)
- State->Stack.pop();
+ while (!State->Stack.empty() && State->Stack.back().increment(EC) == End)
+ State->Stack.pop_back();
if (State->Stack.empty())
State.reset(); // end iterator
diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index ac6d3348b3db9..572d37a2b3e55 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -120,6 +120,7 @@
#include <memory>
#include <numeric>
#include <optional>
+#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
More information about the cfe-commits
mailing list