SuccessChanges

Summary

  1. [MemCpyOpt] Avoid double invalidation (NFCI) (details)
  2. [MemCpyOpt] Add helper to erase instructions (NFC) (details)
  3. [lldb] Add a "design" section to the documentation. (details)
  4. [flang][NFC] Fix mis-matched struct/class declarations (details)
  5. Release the shadow memory used by the mmap range at munmap (details)
  6. [llvm-objcopy][NFC] refactor error handling. part 3. (details)
  7. [Hexagon] Move selection of HVX multiply from lowering to patterns (details)
  8. [libc++] Allow retries on some slightly flaky mutex tests (details)
  9. [Driver] Move detectLibcxxIncludePath to ToolChain (details)
  10. [clang-tidy] Implement readability-function-cognitive-complexity check (details)
  11. [clang] Implement objc_non_runtime_protocol to remove protocol metadata (details)
Commit 87b63c1726e24214272cd6c04825c585635d1cdc by nikita.ppv
[MemCpyOpt] Avoid double invalidation (NFCI)

The removal of the cpy instruction is left to the caller of
performCallSlotOptzn(), including the invalidation of MD. Both
call-sites already do this.

Also handle incrementation of NumMemCpyInstr consistently at the
call-site. One of the call-site was already doing this, which
ended up incrementing the statistic twice.

This fix was part of D26739.
The file was modifiedllvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Commit 94704ed008f78e71aa42a452d8b03c122e0f78cd by nikita.ppv
[MemCpyOpt] Add helper to erase instructions (NFC)

Next to erasing the instruction, we also always want to remove
it from MSSA and MD. Use a common function to do so.

This is a refactoring split out from D26739.
The file was modifiedllvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
The file was modifiedllvm/include/llvm/Transforms/Scalar/MemCpyOptimizer.h
Commit 128e999d63c41e54d5d73c8af47e1ce401e6a200 by Jonas Devlieghere
[lldb] Add a "design" section to the documentation.

Create a "Design" section for the LLDB documentation. The goal is to
have design documents that describe how the LLDB internals work.

Currently similar pages  are mixed together under the "Development". The
existing pages describing the architecture, the reproducers, the
structured data plugins, and the SB API could be housed here. I hope
we'd see more pages being added here in the future.

Differential revision: https://reviews.llvm.org/D88516
The file was addedlldb/docs/design/overview.rst
The file was modifiedlldb/docs/index.rst
The file was addedlldb/docs/design/sbapi.rst
The file was addedlldb/docs/design/structureddataplugins.md
The file was addedlldb/docs/design/reproducers.rst
The file was modifiedlldb/docs/.htaccess
The file was removedlldb/docs/resources/structureddataplugins.md
The file was removedlldb/docs/resources/architecture.rst
The file was removedlldb/docs/resources/reproducers.rst
The file was removedlldb/docs/resources/sbapi.rst
Commit 11622d0fed8c1fb99124ebf4a6aece4bcc83b367 by tkeith
[flang][NFC] Fix mis-matched struct/class declarations

The template `ListDirectedStatementState` was declared as a struct and then as a class.
Fix it so they match.

Differential Revision: https://reviews.llvm.org/D88711
The file was modifiedflang/runtime/io-stmt.h
Commit 045a620c455d2f27a536d687ee6a0299b9e2c734 by jianzhouzh
Release the shadow memory used by the mmap range at munmap

When an application does a lot of pairs of mmap and munmap, if we did
not release shadoe memory used by mmap addresses, this would increase
memory usage.

Reviewed-by: morehouse

Differential Revision: https://reviews.llvm.org/D88686
The file was addedcompiler-rt/test/dfsan/munmap_release_shadow.c
The file was modifiedcompiler-rt/lib/dfsan/dfsan_interceptors.cpp
Commit 0373c768c56fc7ce6fe1efa48383f7b376e7bc2a by a.v.lapshin
[llvm-objcopy][NFC] refactor error handling. part 3.

Remove usages of special error reporting functions(error(),
reportError()). Errors are reported as Expected<>/Error returning
values. This part is for ELF subfolder of llvm-objcopy.

Testing: check-all.

Differential Revision: https://reviews.llvm.org/D87987
The file was modifiedllvm/tools/llvm-objcopy/ELF/Object.h
The file was removedllvm/tools/llvm-objcopy/llvm-objcopy.h
The file was modifiedllvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
The file was modifiedllvm/tools/llvm-objcopy/MachO/MachOReader.cpp
The file was modifiedllvm/tools/llvm-objcopy/ELF/Object.cpp
The file was modifiedllvm/tools/llvm-objcopy/wasm/WasmObjcopy.cpp
The file was modifiedllvm/tools/llvm-objcopy/MachO/Object.cpp
The file was modifiedllvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
The file was modifiedllvm/tools/llvm-objcopy/llvm-objcopy.cpp
Commit f528816d586a42e4cf27af5b2fa9ba91213307aa by kparzysz
[Hexagon] Move selection of HVX multiply from lowering to patterns

Also, change i32*i32 to V6_vmpyieoh + V6_vmpyiewuh_acc, which works
on V60 as well.
The file was modifiedllvm/lib/Target/Hexagon/HexagonPatternsHVX.td
The file was modifiedllvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp
The file was modifiedllvm/test/CodeGen/Hexagon/autohvx/arith.ll
Commit f7e91e6cc7f35dd0dcc176463a355d78e1c020b1 by Louis Dionne
[libc++] Allow retries on some slightly flaky mutex tests
The file was modifiedlibcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/lock.pass.cpp
The file was modifiedlibcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_try_to_lock.pass.cpp
Commit a594fd28e373cb7cd348cf01f6a90e055bf6cf6d by phosek
[Driver] Move detectLibcxxIncludePath to ToolChain

This helper method is useful even outside of Gnu toolchains, so move
it to ToolChain so it can be reused in other toolchains such as Fuchsia.

Differential Revision: https://reviews.llvm.org/D88452
The file was modifiedclang/lib/Driver/ToolChains/Fuchsia.cpp
The file was modifiedclang/include/clang/Driver/ToolChain.h
The file was modifiedclang/lib/Driver/ToolChain.cpp
The file was modifiedclang/lib/Driver/ToolChains/Gnu.cpp
Commit ace644030e67506114d3ac9a221cf8eb5d10159c by lebedev.ri
[clang-tidy] Implement readability-function-cognitive-complexity check

Currently, there is basically just one clang-tidy check to impose
some sanity limits on functions - `clang-tidy-readability-function-size`.
It is nice, allows to limit line count, total number of statements,
number of branches, number of function parameters (not counting
implicit `this`), nesting level.

However, those are simple generic metrics. It is still trivially possible
to write a function, which does not violate any of these metrics,
yet is still rather unreadable.

Thus, some additional, slightly more complicated metric is needed.
There is a well-known [[ https://en.wikipedia.org/wiki/Cyclomatic_complexity | Cyclomatic complexity]], but certainly has its downsides.
And there is a [[ https://www.sonarsource.com/docs/CognitiveComplexity.pdf | COGNITIVE COMPLEXITY by SonarSource ]], which is available for opensource on https://sonarcloud.io/.

This check checks function Cognitive Complexity metric, and flags
the functions with Cognitive Complexity exceeding the configured limit.
The default limit is `25`, same as in 'upstream'.

The metric is implemented as per [[ https://www.sonarsource.com/docs/CognitiveComplexity.pdf | COGNITIVE COMPLEXITY by SonarSource ]] specification version 1.2 (19 April 2017), with two notable exceptions:
   * `preprocessor conditionals` (`#ifdef`, `#if`, `#elif`, `#else`,
     `#endif`) are not accounted for.
      Could be done. Currently, upstream does not account for them either.
   * `each method in a recursion cycle` is not accounted for.
      It can't be fully implemented, because cross-translational-unit
      analysis would be needed, which is not possible in clang-tidy.
      Thus, at least right now, i completely avoided implementing it.

There are some further possible improvements:
* Are GNU statement expressions (`BinaryConditionalOperator`) really free?
  They should probably cause nesting level increase,
  and complexity level increase when they are nested within eachother.
* Microsoft SEH support
* ???

Reviewed By: aaron.ballman, JonasToth, lattner

Differential Revision: https://reviews.llvm.org/D36836
The file was modifiedclang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
The file was modifiedclang-tools-extra/docs/clang-tidy/checks/list.rst
The file was addedclang-tools-extra/test/clang-tidy/checkers/readability-function-cognitive-complexity.cpp
The file was modifiedclang-tools-extra/clang-tidy/readability/CMakeLists.txt
The file was addedclang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp
The file was addedclang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.h
The file was modifiedclang-tools-extra/docs/ReleaseNotes.rst
The file was addedclang-tools-extra/docs/clang-tidy/checks/readability-function-cognitive-complexity.rst
Commit 14f6bfcb52e77867a6a84fcfd9e21bb5f1f5795c by nathan
[clang] Implement objc_non_runtime_protocol to remove protocol metadata

Summary:
Motivated by the new objc_direct attribute, this change adds a new
attribute that remotes metadata from Protocols that the programmer knows
isn't going to be used at runtime. We simply have the frontend skip
generating any protocol metadata entries (e.g. OBJC_CLASS_NAME,
_OBJC_$_PROTOCOL_INSTANCE_METHDOS, _OBJC_PROTOCOL, etc) for a protocol
marked with `__attribute__((objc_non_runtime_protocol))`.

There are a few APIs used to retrieve a protocol at runtime.
`@protocol(SomeProtocol)` will now error out of the requested protocol
is marked with attribute. `objc_getProtocol` will return `NULL` which
is consistent with the behavior of a non-existing protocol.

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75574
The file was modifiedclang/lib/CodeGen/CGObjCGNU.cpp
The file was modifiedclang/lib/AST/DeclObjC.cpp
The file was modifiedclang/include/clang/Basic/Attr.td
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td
The file was modifiedclang/lib/CodeGen/CGObjCRuntime.h
The file was modifiedclang/lib/Sema/SemaDeclAttr.cpp
The file was modifiedclang/lib/Sema/SemaExprObjC.cpp
The file was modifiedclang/include/clang/AST/DeclObjC.h
The file was modifiedclang/include/clang/Basic/AttrDocs.td
The file was modifiedclang/lib/CodeGen/CGObjCMac.cpp
The file was addedclang/test/CodeGenObjC/non-runtime-protocol.m
The file was modifiedclang/lib/CodeGen/CGObjC.cpp
The file was modifiedclang/test/Misc/pragma-attribute-supported-attributes-list.test