diff options
author | Fangrui Song <i@maskray.me> | 2022-08-09 07:11:18 +0000 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2022-08-09 07:11:18 +0000 |
commit | 32197830ef5990d31b5582c9d497b2a96a1a381f (patch) | |
tree | f74f9f8bf064de2652e4ea7a5dfe97a89ff9c456 /clang-tools-extra | |
parent | d3580c2eb6ec95256a65ce7f66346351e9852eab (diff) | |
download | llvm-32197830ef5990d31b5582c9d497b2a96a1a381f.zip llvm-32197830ef5990d31b5582c9d497b2a96a1a381f.tar.gz llvm-32197830ef5990d31b5582c9d497b2a96a1a381f.tar.bz2 |
[clang][clang-tools-extra] LLVM_NODISCARD => [[nodiscard]]. NFC
Diffstat (limited to 'clang-tools-extra')
-rw-r--r-- | clang-tools-extra/clang-tidy/ClangTidyOptions.h | 4 | ||||
-rw-r--r-- | clang-tools-extra/clangd/ClangdServer.cpp | 2 | ||||
-rw-r--r-- | clang-tools-extra/clangd/ClangdServer.h | 2 | ||||
-rw-r--r-- | clang-tools-extra/clangd/index/Background.h | 4 | ||||
-rw-r--r-- | clang-tools-extra/clangd/index/Serialization.cpp | 2 | ||||
-rw-r--r-- | clang-tools-extra/clangd/support/Context.h | 4 | ||||
-rw-r--r-- | clang-tools-extra/clangd/support/Function.h | 2 | ||||
-rw-r--r-- | clang-tools-extra/clangd/support/Threading.h | 8 |
8 files changed, 14 insertions, 14 deletions
diff --git a/clang-tools-extra/clang-tidy/ClangTidyOptions.h b/clang-tools-extra/clang-tidy/ClangTidyOptions.h index 3f09d39..20e5421 100644 --- a/clang-tools-extra/clang-tidy/ClangTidyOptions.h +++ b/clang-tools-extra/clang-tidy/ClangTidyOptions.h @@ -63,8 +63,8 @@ struct ClangTidyOptions { /// Creates a new \c ClangTidyOptions instance combined from all fields /// of this instance overridden by the fields of \p Other that have a value. /// \p Order specifies precedence of \p Other option. - LLVM_NODISCARD ClangTidyOptions merge(const ClangTidyOptions &Other, - unsigned Order) const; + [[nodiscard]] ClangTidyOptions merge(const ClangTidyOptions &Other, + unsigned Order) const; /// Checks filter. llvm::Optional<std::string> Checks; diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp index 5ab6cb7..eccb2cd 100644 --- a/clang-tools-extra/clangd/ClangdServer.cpp +++ b/clang-tools-extra/clangd/ClangdServer.cpp @@ -1000,7 +1000,7 @@ llvm::StringMap<TUScheduler::FileStats> ClangdServer::fileStats() const { return WorkScheduler->fileStats(); } -LLVM_NODISCARD bool +[[nodiscard]] bool ClangdServer::blockUntilIdleForTest(llvm::Optional<double> TimeoutSeconds) { // Order is important here: we don't want to block on A and then B, // if B might schedule work on A. diff --git a/clang-tools-extra/clangd/ClangdServer.h b/clang-tools-extra/clangd/ClangdServer.h index dacb7b7..99c56eb 100644 --- a/clang-tools-extra/clangd/ClangdServer.h +++ b/clang-tools-extra/clangd/ClangdServer.h @@ -390,7 +390,7 @@ public: // Returns false if the timeout expires. // FIXME: various subcomponents each get the full timeout, so it's more of // an order of magnitude than a hard deadline. - LLVM_NODISCARD bool + [[nodiscard]] bool blockUntilIdleForTest(llvm::Optional<double> TimeoutSeconds = 10); /// Builds a nested representation of memory used by components. diff --git a/clang-tools-extra/clangd/index/Background.h b/clang-tools-extra/clangd/index/Background.h index 688c098..ac99a15 100644 --- a/clang-tools-extra/clangd/index/Background.h +++ b/clang-tools-extra/clangd/index/Background.h @@ -110,7 +110,7 @@ public: // Disables thread priority lowering to ensure progress on loaded systems. // Only affects tasks that run after the call. static void preventThreadStarvationInTests(); - LLVM_NODISCARD bool + [[nodiscard]] bool blockUntilIdleForTest(llvm::Optional<double> TimeoutSeconds); private: @@ -172,7 +172,7 @@ public: } // Wait until the queue is empty, to allow deterministic testing. - LLVM_NODISCARD bool + [[nodiscard]] bool blockUntilIdleForTest(llvm::Optional<double> TimeoutSeconds = 10) { return Queue.blockUntilIdleForTest(TimeoutSeconds); } diff --git a/clang-tools-extra/clangd/index/Serialization.cpp b/clang-tools-extra/clangd/index/Serialization.cpp index 9fc1567..9270c89 100644 --- a/clang-tools-extra/clangd/index/Serialization.cpp +++ b/clang-tools-extra/clangd/index/Serialization.cpp @@ -116,7 +116,7 @@ public: // Read a varint (as consumeVar) and resize the container accordingly. // If the size is invalid, return false and mark an error. // (The caller should abort in this case). - template <typename T> LLVM_NODISCARD bool consumeSize(T &Container) { + template <typename T> [[nodiscard]] bool consumeSize(T &Container) { auto Size = consumeVar(); // Conservatively assume each element is at least one byte. if (Size > (size_t)(End - Begin)) { diff --git a/clang-tools-extra/clangd/support/Context.h b/clang-tools-extra/clangd/support/Context.h index 815962b..a33a9ff 100644 --- a/clang-tools-extra/clangd/support/Context.h +++ b/clang-tools-extra/clangd/support/Context.h @@ -184,7 +184,7 @@ private: /// WithContext replaces Context::current() with a provided scope. /// When the WithContext is destroyed, the original scope is restored. /// For extending the current context with new value, prefer WithContextValue. -class LLVM_NODISCARD WithContext { +class [[nodiscard]] WithContext { public: WithContext(Context C) : Restore(Context::swapCurrent(std::move(C))) {} ~WithContext() { Context::swapCurrent(std::move(Restore)); } @@ -199,7 +199,7 @@ private: /// WithContextValue extends Context::current() with a single value. /// When the WithContextValue is destroyed, the original scope is restored. -class LLVM_NODISCARD WithContextValue { +class [[nodiscard]] WithContextValue { public: template <typename T> WithContextValue(const Key<T> &K, typename std::decay<T>::type V) diff --git a/clang-tools-extra/clangd/support/Function.h b/clang-tools-extra/clangd/support/Function.h index 936800d..dc9216b 100644 --- a/clang-tools-extra/clangd/support/Function.h +++ b/clang-tools-extra/clangd/support/Function.h @@ -35,7 +35,7 @@ public: // A subscription defines the scope of when a listener should receive events. // After destroying the subscription, no more events are received. - class LLVM_NODISCARD Subscription { + class [[nodiscard]] Subscription { Event *Parent; unsigned ListenerID; diff --git a/clang-tools-extra/clangd/support/Threading.h b/clang-tools-extra/clangd/support/Threading.h index 7d5cd0d..fb9f620 100644 --- a/clang-tools-extra/clangd/support/Threading.h +++ b/clang-tools-extra/clangd/support/Threading.h @@ -76,8 +76,8 @@ void wait(std::unique_lock<std::mutex> &Lock, std::condition_variable &CV, Deadline D); /// Waits on a condition variable until F() is true or D expires. template <typename Func> -LLVM_NODISCARD bool wait(std::unique_lock<std::mutex> &Lock, - std::condition_variable &CV, Deadline D, Func F) { +[[nodiscard]] bool wait(std::unique_lock<std::mutex> &Lock, + std::condition_variable &CV, Deadline D, Func F) { while (!F()) { if (D.expired()) return false; @@ -93,7 +93,7 @@ public: void notify(); // Blocks until flag is set. void wait() const { (void)wait(Deadline::infinity()); } - LLVM_NODISCARD bool wait(Deadline D) const; + [[nodiscard]] bool wait(Deadline D) const; private: bool Notified = false; @@ -110,7 +110,7 @@ public: ~AsyncTaskRunner(); void wait() const { (void)wait(Deadline::infinity()); } - LLVM_NODISCARD bool wait(Deadline D) const; + [[nodiscard]] bool wait(Deadline D) const; // The name is used for tracing and debugging (e.g. to name a spawned thread). void runAsync(const llvm::Twine &Name, llvm::unique_function<void()> Action); |