Skip to content

Commit

Permalink
Merged master:3a6c2a61c64 into amd-gfx:774eac45315
Browse files Browse the repository at this point in the history
Local branch amd-gfx 774eac4 Merged master:3382c243baf into amd-gfx:48fe0476935
Remote branch master 3a6c2a6 [mips] Rename FeatureMadd4 to FeatureNoMadd4. NFC
  • Loading branch information
Sw authored and Sw committed Jul 15, 2020
2 parents 774eac4 + 3a6c2a6 commit 802fca2
Show file tree
Hide file tree
Showing 56 changed files with 8,781 additions and 651 deletions.
24 changes: 14 additions & 10 deletions clang-tools-extra/clangd/TUScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@ void ASTWorker::startTask(llvm::StringRef Name,
if (RunSync) {
assert(!Done && "running a task after stop()");
trace::Span Tracer(Name + ":" + llvm::sys::path::filename(FileName));
WithContext WithProvidedContext(ContextProvider(FileName));
Task();
return;
}
Expand Down Expand Up @@ -1062,9 +1063,7 @@ void ASTWorker::run() {
Status.ASTActivity.K = ASTAction::RunningAction;
Status.ASTActivity.Name = CurrentRequest->Name;
});
llvm::Optional<WithContext> WithProvidedContext;
if (ContextProvider)
WithProvidedContext.emplace(ContextProvider(FileName));
WithContext WithProvidedContext(ContextProvider(FileName));
CurrentRequest->Action();
}

Expand Down Expand Up @@ -1238,6 +1237,12 @@ TUScheduler::TUScheduler(const GlobalCompilationDatabase &CDB,
Barrier(Opts.AsyncThreadsCount),
IdleASTs(
std::make_unique<ASTCache>(Opts.RetentionPolicy.MaxRetainedASTs)) {
// Avoid null checks everywhere.
if (!Opts.ContextProvider) {
this->Opts.ContextProvider = [](llvm::StringRef) {
return Context::current().clone();
};
}
if (0 < Opts.AsyncThreadsCount) {
PreambleTasks.emplace();
WorkerThreads.emplace();
Expand Down Expand Up @@ -1300,16 +1305,16 @@ llvm::StringMap<std::string> TUScheduler::getAllFileContents() const {

void TUScheduler::run(llvm::StringRef Name, llvm::StringRef Path,
llvm::unique_function<void()> Action) {
if (!PreambleTasks)
if (!PreambleTasks) {
WithContext WithProvidedContext(Opts.ContextProvider(Path));
return Action();
}
PreambleTasks->runAsync(Name, [this, Ctx = Context::current().clone(),
Path(Path.str()),
Action = std::move(Action)]() mutable {
std::lock_guard<Semaphore> BarrierLock(Barrier);
WithContext WC(std::move(Ctx));
llvm::Optional<WithContext> WithProvidedContext;
if (Opts.ContextProvider)
WithProvidedContext.emplace(Opts.ContextProvider(Path));
WithContext WithProvidedContext(Opts.ContextProvider(Path));
Action();
});
}
Expand Down Expand Up @@ -1344,6 +1349,7 @@ void TUScheduler::runWithPreamble(llvm::StringRef Name, PathRef File,
SPAN_ATTACH(Tracer, "file", File);
std::shared_ptr<const PreambleData> Preamble =
It->second->Worker->getPossiblyStalePreamble();
WithContext WithProvidedContext(Opts.ContextProvider(File));
Action(InputsAndPreamble{It->second->Contents,
It->second->Worker->getCurrentCompileCommand(),
Preamble.get()});
Expand All @@ -1370,9 +1376,7 @@ void TUScheduler::runWithPreamble(llvm::StringRef Name, PathRef File,
WithContext Guard(std::move(Ctx));
trace::Span Tracer(Name);
SPAN_ATTACH(Tracer, "file", File);
llvm::Optional<WithContext> WithProvidedContext;
if (Opts.ContextProvider)
WithProvidedContext.emplace(Opts.ContextProvider(File));
WithContext WithProvidedContext(Opts.ContextProvider(File));
Action(InputsAndPreamble{Contents, Command, Preamble.get()});
};

Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/TUScheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ class TUScheduler {

private:
const GlobalCompilationDatabase &CDB;
const Options Opts;
Options Opts;
std::unique_ptr<ParsingCallbacks> Callbacks; // not nullptr
Semaphore Barrier;
llvm::StringMap<std::unique_ptr<FileData>> Files;
Expand Down
41 changes: 22 additions & 19 deletions clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -864,25 +864,28 @@ TEST_F(TUSchedulerTests, NoChangeDiags) {
}

TEST_F(TUSchedulerTests, Run) {
auto Opts = optsForTest();
Opts.ContextProvider = bindPath;
TUScheduler S(CDB, Opts);
std::atomic<int> Counter(0);
S.run("add 1", /*Path=*/"", [&] { ++Counter; });
S.run("add 2", /*Path=*/"", [&] { Counter += 2; });
ASSERT_TRUE(S.blockUntilIdle(timeoutSeconds(10)));
EXPECT_EQ(Counter.load(), 3);

Notification TaskRun;
Key<int> TestKey;
WithContextValue CtxWithKey(TestKey, 10);
const char *Path = "somepath";
S.run("props context", Path, [&] {
EXPECT_EQ(Context::current().getExisting(TestKey), 10);
EXPECT_EQ(Path, boundPath());
TaskRun.notify();
});
TaskRun.wait();
for (bool Sync : {false, true}) {
auto Opts = optsForTest();
if (Sync)
Opts.AsyncThreadsCount = 0;
TUScheduler S(CDB, Opts);
std::atomic<int> Counter(0);
S.run("add 1", /*Path=*/"", [&] { ++Counter; });
S.run("add 2", /*Path=*/"", [&] { Counter += 2; });
ASSERT_TRUE(S.blockUntilIdle(timeoutSeconds(10)));
EXPECT_EQ(Counter.load(), 3);

Notification TaskRun;
Key<int> TestKey;
WithContextValue CtxWithKey(TestKey, 10);
const char *Path = "somepath";
S.run("props context", Path, [&] {
EXPECT_EQ(Context::current().getExisting(TestKey), 10);
EXPECT_EQ(Path, boundPath());
TaskRun.notify();
});
TaskRun.wait();
}
}

TEST_F(TUSchedulerTests, TUStatus) {
Expand Down
190 changes: 5 additions & 185 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
====================================================
Extra Clang Tools 11.0.0 (In-Progress) Release Notes
Extra Clang Tools 12.0.0 (In-Progress) Release Notes
====================================================

.. contents::
Expand All @@ -10,15 +10,15 @@ Written by the `LLVM Team <https://llvm.org/>`_

.. warning::

These are in-progress notes for the upcoming Extra Clang Tools 11 release.
These are in-progress notes for the upcoming Extra Clang Tools 12 release.
Release notes for previous releases can be found on
`the Download Page <https://releases.llvm.org/download.html>`_.

Introduction
============

This document contains the release notes for the Extra Clang Tools, part of the
Clang release 11.0.0. Here we describe the status of the Extra Clang Tools in
Clang release 12.0.0. Here we describe the status of the Extra Clang Tools in
some detail, including major improvements from the previous release and new
feature work. All LLVM releases may be downloaded from the `LLVM releases web
site <https://llvm.org/releases/>`_.
Expand All @@ -32,7 +32,7 @@ main Clang web page, this document applies to the *next* release, not
the current one. To see the release notes for a specific release, please
see the `releases page <https://llvm.org/releases/>`_.

What's New in Extra Clang Tools 11.0.0?
What's New in Extra Clang Tools 12.0.0?
=======================================

Some of the major new features and improvements to Extra Clang Tools are listed
Expand Down Expand Up @@ -67,187 +67,7 @@ The improvements are...
Improvements to clang-tidy
--------------------------

New module
^^^^^^^^^^
- New module `llvmlibc`.

This module contains checks related to the LLVM-libc coding standards.

New checks
^^^^^^^^^^

- New :doc:`abseil-string-find-str-contains
<clang-tidy/checks/abseil-string-find-str-contains>` check.

Finds ``s.find(...) == string::npos`` comparisons (for various string-like types)
and suggests replacing with ``absl::StrContains()``.

- New :doc:`cppcoreguidelines-avoid-non-const-global-variables
<clang-tidy/checks/cppcoreguidelines-avoid-non-const-global-variables>` check.
Finds non-const global variables as described in check I.2 of C++ Core
Guidelines.

- New :doc:`bugprone-misplaced-pointer-arithmetic-in-alloc
<clang-tidy/checks/bugprone-misplaced-pointer-arithmetic-in-alloc>` check.

Finds cases where an integer expression is added to or subtracted from the
result of a memory allocation function (``malloc()``, ``calloc()``,
``realloc()``, ``alloca()``) instead of its argument.

- New :doc:`bugprone-no-escape
<clang-tidy/checks/bugprone-no-escape>` check.

Finds pointers with the ``noescape`` attribute that are captured by an
asynchronously-executed block.

- New :doc:`bugprone-spuriously-wake-up-functions
<clang-tidy/checks/bugprone-spuriously-wake-up-functions>` check.

Finds ``cnd_wait``, ``cnd_timedwait``, ``wait``, ``wait_for``, or
``wait_until`` function calls when the function is not invoked from a loop
that checks whether a condition predicate holds or the function has a
condition parameter.

- New :doc:`bugprone-reserved-identifier
<clang-tidy/checks/bugprone-reserved-identifier>` check.

Checks for usages of identifiers reserved for use by the implementation.

- New :doc:`bugprone-suspicious-include
<clang-tidy/checks/bugprone-suspicious-include>` check.

Finds cases where an include refers to what appears to be an implementation
file, which often leads to hard-to-track-down ODR violations, and diagnoses
them.

- New :doc:`cert-oop57-cpp
<clang-tidy/checks/cert-oop57-cpp>` check.

Flags use of the `C` standard library functions ``memset``, ``memcpy`` and
``memcmp`` and similar derivatives on non-trivial types.

- New :doc:`llvmlibc-callee-namespace
<clang-tidy/checks/llvmlibc-callee-namespace>` check.

Checks all calls resolve to functions within ``__llvm_libc`` namespace.

- New :doc:`llvmlibc-implementation-in-namespace
<clang-tidy/checks/llvmlibc-implementation-in-namespace>` check.

Checks all llvm-libc implementation is within the correct namespace.

- New :doc:`llvmlibc-restrict-system-libc-headers
<clang-tidy/checks/llvmlibc-restrict-system-libc-headers>` check.

Finds includes of system libc headers not provided by the compiler within
llvm-libc implementations.

- New :doc:`modernize-replace-disallow-copy-and-assign-macro
<clang-tidy/checks/modernize-replace-disallow-copy-and-assign-macro>` check.

Finds macro expansions of ``DISALLOW_COPY_AND_ASSIGN`` and replaces them with
a deleted copy constructor and a deleted assignment operator.

- New :doc:`objc-dealloc-in-category
<clang-tidy/checks/objc-dealloc-in-category>` check.

Finds implementations of -dealloc in Objective-C categories.

- New :doc:`misc-no-recursion
<clang-tidy/checks/misc-no-recursion>` check.

Finds recursive functions and diagnoses them.

- New :doc:`objc-nsinvocation-argument-lifetime
<clang-tidy/checks/objc-nsinvocation-argument-lifetime>` check.

Finds calls to ``NSInvocation`` methods under ARC that don't have proper
argument object lifetimes.

- New :doc:`readability-use-anyofallof
<clang-tidy/checks/readability-use-anyofallof>` check.

Finds range-based for loops that can be replaced by a call to ``std::any_of``
or ``std::all_of``.

New check aliases
^^^^^^^^^^^^^^^^^

- New alias :doc:`cert-con36-c
<clang-tidy/checks/cert-con36-c>` to
:doc:`bugprone-spuriously-wake-up-functions
<clang-tidy/checks/bugprone-spuriously-wake-up-functions>` was added.

- New alias :doc:`cert-con54-cpp
<clang-tidy/checks/cert-con54-cpp>` to
:doc:`bugprone-spuriously-wake-up-functions
<clang-tidy/checks/bugprone-spuriously-wake-up-functions>` was added.

- New alias :doc:`cert-dcl37-c
<clang-tidy/checks/cert-dcl37-c>` to
:doc:`bugprone-reserved-identifier
<clang-tidy/checks/bugprone-reserved-identifier>` was added.

- New alias :doc:`cert-dcl51-cpp
<clang-tidy/checks/cert-dcl51-cpp>` to
:doc:`bugprone-reserved-identifier
<clang-tidy/checks/bugprone-reserved-identifier>` was added.

- New alias :doc:`cert-str34-c
<clang-tidy/checks/cert-str34-c>` to
:doc:`bugprone-signed-char-misuse
<clang-tidy/checks/bugprone-signed-char-misuse>` was added.

- New alias :doc:`llvm-else-after-return
<clang-tidy/checks/llvm-else-after-return>` to
:doc:`readability-else-after-return
<clang-tidy/checks/readability-else-after-return>` was added.

Changes in existing checks
^^^^^^^^^^^^^^^^^^^^^^^^^^

- Improved :doc:`performance-faster-string-find
<clang-tidy/checks/performance-faster-string-find>` check.

Now checks ``std::basic_string_view`` by default.

- Improved :doc:`readability-else-after-return
<clang-tidy/checks/readability-else-after-return>` check now supports a
`WarnOnConditionVariables` option to control whether to refactor condition
variables where possible.

- Improved :doc:`readability-identifier-naming
<clang-tidy/checks/readability-identifier-naming>` check.

Now able to rename member references in class template definitions with
explicit access.

- Improved :doc:`readability-qualified-auto
<clang-tidy/checks/readability-qualified-auto>` check now supports a
`AddConstToQualified` to enable adding ``const`` qualifiers to variables
typed with ``auto *`` and ``auto &``.

- Improved :doc:`readability-redundant-string-init
<clang-tidy/checks/readability-redundant-string-init>` check now supports a
`StringNames` option enabling its application to custom string classes. The
check now detects in class initializers and constructor initializers which
are deemed to be redundant.

- Checks supporting the ``HeaderFileExtensions`` flag now support ``;`` as a
delimiter in addition to ``,``, with the latter being deprecated as of this
release. This simplifies how one specifies the options on the command line:
``--config="{CheckOptions: [{ key: HeaderFileExtensions, value: h;;hpp;hxx }]}"``

Renamed checks
^^^^^^^^^^^^^^

- The 'fuchsia-restrict-system-headers' check was renamed to :doc:`portability-restrict-system-includes
<clang-tidy/checks/portability-restrict-system-includes>`

Other improvements
^^^^^^^^^^^^^^^^^^

- For 'run-clang-tidy.py' add option to use alpha checkers from clang-analyzer.
The improvements are...

Improvements to include-fixer
-----------------------------
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
# built documents.
#
# The short version.
version = '11'
version = '12'
# The full version, including alpha/beta/rc tags.
release = '11'
release = '12'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
Loading

0 comments on commit 802fca2

Please sign in to comment.