Skip to content

Commit 5546d0e

Browse files
authored
Merge pull request #503 from Xilinx/bump_to_465a3ce9
[AutoBump] Merge with 465a3ce (Jan 09) (33)
2 parents e04ed7e + ee87c02 commit 5546d0e

File tree

707 files changed

+48183
-39542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

707 files changed

+48183
-39542
lines changed

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ RUN apt-get update && \
5757
nodejs \
5858
perl-modules \
5959
python3-psutil \
60+
sudo \
6061

6162
# These are needed by the premerge pipeline. Pip is used to install
6263
# dependent python packages and ccache is used for build caching. File and
@@ -66,12 +67,28 @@ RUN apt-get update && \
6667
file \
6768
tzdata
6869

70+
# Install sccache as it is needed by most of the project test workflows and
71+
# cannot be installed by the ccache action when executing as a non-root user.
72+
# TODO(boomanaiden154): This should be switched to being installed with apt
73+
# once we bump to Ubuntu 24.04.
74+
RUN curl -L 'https://github.com/mozilla/sccache/releases/download/v0.7.6/sccache-v0.7.6-x86_64-unknown-linux-musl.tar.gz' > /tmp/sccache.tar.gz && \
75+
echo "2902a5e44c3342132f07b62e70cca75d9b23252922faf3b924f449808cc1ae58 /tmp/sccache.tar.gz" | sha256sum -c && \
76+
tar xzf /tmp/sccache.tar.gz -O --wildcards '*/sccache' > '/usr/local/bin/sccache' && \
77+
rm /tmp/sccache.tar.gz && \
78+
chmod +x /usr/local/bin/sccache
79+
6980
ENV LLVM_SYSROOT=$LLVM_SYSROOT
7081
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
7182

7283
# Create a new user to avoid test failures related to a lack of expected
7384
# permissions issues in some tests. Set the user id to 1001 as that is the
7485
# user id that Github Actions uses to perform the checkout action.
7586
RUN useradd gha -u 1001 -m -s /bin/bash
87+
88+
# Also add the user to passwordless sudoers so that we can install software
89+
# later on without having to rebuild the container.
90+
RUN adduser gha sudo
91+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
92+
7693
USER gha
7794

.github/workflows/premerge.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ jobs:
3131
- name: Setup ccache
3232
uses: hendrikmuhs/[email protected]
3333
- name: Build and Test
34+
# Mark the job as a success even if the step fails so that people do
35+
# not get notified while the new premerge pipeline is in an
36+
# experimental state.
37+
# TODO(boomanaiden154): Remove this once the pipeline is stable and we
38+
# are ready for people to start recieving notifications.
39+
continue-on-error: true
3440
run: |
3541
git config --global --add safe.directory '*'
3642

clang-tools-extra/clang-tidy/bugprone/UnusedLocalNonTrivialVariableCheck.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "clang/ASTMatchers/ASTMatchFinder.h"
1616
#include "clang/ASTMatchers/ASTMatchers.h"
1717
#include "clang/ASTMatchers/ASTMatchersMacros.h"
18+
#include "clang/Basic/LangOptions.h"
1819

1920
using namespace clang::ast_matchers;
2021
using namespace clang::tidy::matchers;
@@ -29,6 +30,13 @@ static constexpr StringRef DefaultIncludeTypeRegex =
2930

3031
AST_MATCHER(VarDecl, isLocalVarDecl) { return Node.isLocalVarDecl(); }
3132
AST_MATCHER(VarDecl, isReferenced) { return Node.isReferenced(); }
33+
AST_MATCHER(VarDecl, explicitMarkUnused) {
34+
// Implementations should not emit a warning that a name-independent
35+
// declaration is used or unused.
36+
LangOptions const &LangOpts = Finder->getASTContext().getLangOpts();
37+
return Node.hasAttr<UnusedAttr>() ||
38+
(LangOpts.CPlusPlus26 && Node.isPlaceholderVar(LangOpts));
39+
}
3240
AST_MATCHER(Type, isReferenceType) { return Node.isReferenceType(); }
3341
AST_MATCHER(QualType, isTrivial) {
3442
return Node.isTrivialType(Finder->getASTContext()) ||
@@ -60,7 +68,7 @@ void UnusedLocalNonTrivialVariableCheck::registerMatchers(MatchFinder *Finder) {
6068
varDecl(isLocalVarDecl(), unless(isReferenced()),
6169
unless(isExceptionVariable()), hasLocalStorage(), isDefinition(),
6270
unless(hasType(isReferenceType())), unless(hasType(isTrivial())),
63-
unless(hasAttr(attr::Kind::Unused)),
71+
unless(explicitMarkUnused()),
6472
hasType(hasUnqualifiedDesugaredType(
6573
anyOf(recordType(hasDeclaration(namedDecl(
6674
matchesAnyListedName(IncludeTypes),

clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,13 @@ TEST_F(LSPTest, ClangTidyRename) {
208208
Annotations Source(R"cpp(
209209
void [[foo]]() {}
210210
)cpp");
211-
Opts.ClangTidyProvider = [](tidy::ClangTidyOptions &ClangTidyOpts,
212-
llvm::StringRef) {
211+
constexpr auto ClangTidyProvider = [](tidy::ClangTidyOptions &ClangTidyOpts,
212+
llvm::StringRef) {
213213
ClangTidyOpts.Checks = {"-*,readability-identifier-naming"};
214214
ClangTidyOpts.CheckOptions["readability-identifier-naming.FunctionCase"] =
215215
"CamelCase";
216216
};
217+
Opts.ClangTidyProvider = ClangTidyProvider;
217218
auto &Client = start();
218219
Client.didOpen("foo.hpp", Header.code());
219220
Client.didOpen("foo.cpp", Source.code());
@@ -266,10 +267,11 @@ TEST_F(LSPTest, ClangTidyCrash_Issue109367) {
266267
// This test requires clang-tidy checks to be linked in.
267268
if (!CLANGD_TIDY_CHECKS)
268269
return;
269-
Opts.ClangTidyProvider = [](tidy::ClangTidyOptions &ClangTidyOpts,
270-
llvm::StringRef) {
270+
constexpr auto ClangTidyProvider = [](tidy::ClangTidyOptions &ClangTidyOpts,
271+
llvm::StringRef) {
271272
ClangTidyOpts.Checks = {"-*,boost-use-ranges"};
272273
};
274+
Opts.ClangTidyProvider = ClangTidyProvider;
273275
// Check that registering the boost-use-ranges checker's matchers
274276
// on two different threads does not cause a crash.
275277
auto &Client = start();

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ Changes in existing checks
241241
<clang-tidy/checks/bugprone/unsafe-functions>` check to allow specifying
242242
additional functions to match.
243243

244+
- Improved :doc:`bugprone-unused-local-non-trivial-variable
245+
<clang-tidy/checks/bugprone/unused-local-non-trivial-variable>` check to avoid
246+
false positives when using name-independent variables after C++26.
247+
244248
- Improved :doc:`bugprone-use-after-move
245249
<clang-tidy/checks/bugprone/use-after-move>` to avoid triggering on
246250
``reset()`` calls on moved-from ``std::optional`` and ``std::any`` objects,
@@ -346,6 +350,10 @@ Changes in existing checks
346350
file path for anonymous enums in the diagnostic, and by fixing a typo in the
347351
diagnostic.
348352

353+
- Improved :doc:`readability-identifier-naming
354+
<clang-tidy/checks/readability/identifier-naming>` check to
355+
validate ``namespace`` aliases.
356+
349357
- Improved :doc:`readability-implicit-bool-conversion
350358
<clang-tidy/checks/readability/implicit-bool-conversion>` check
351359
by adding the option `UseUpperCaseLiteralSuffix` to select the
@@ -356,10 +364,6 @@ Changes in existing checks
356364
<clang-tidy/checks/readability/redundant-smartptr-get>` check to
357365
remove `->`, when redundant `get()` is removed.
358366

359-
- Improved :doc:`readability-identifier-naming
360-
<clang-tidy/checks/readability/identifier-naming>` check to
361-
validate ``namespace`` aliases.
362-
363367
Removed checks
364368
^^^^^^^^^^^^^^
365369

clang-tools-extra/docs/clang-tidy/checks/bugprone/unused-local-non-trivial-variable.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The following types of variables are excluded from this check:
1212
* static or thread local
1313
* structured bindings
1414
* variables with ``[[maybe_unused]]`` attribute
15+
* name-independent variables
1516

1617
This check can be configured to warn on all non-trivial variables by setting
1718
`IncludeTypes` to `.*`, and excluding specific types using `ExcludeTypes`.

clang-tools-extra/include-cleaner/lib/Analysis.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ analyze(llvm::ArrayRef<Decl *> ASTRoots,
8585
const auto MainFile = *SM.getFileEntryRefForID(SM.getMainFileID());
8686
llvm::DenseSet<const Include *> Used;
8787
llvm::StringMap<Header> Missing;
88+
constexpr auto DefaultHeaderFilter = [](llvm::StringRef) { return false; };
8889
if (!HeaderFilter)
89-
HeaderFilter = [](llvm::StringRef) { return false; };
90+
HeaderFilter = DefaultHeaderFilter;
9091
OptionalDirectoryEntryRef ResourceDir =
9192
PP.getHeaderSearchInfo().getModuleMap().getBuiltinDir();
9293
walkUsed(ASTRoots, MacroRefs, PI, PP,
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: %check_clang_tidy -std=c++23 -check-suffixes=,CXX23 %s bugprone-unused-local-non-trivial-variable %t -- \
2+
// RUN: -config="{CheckOptions: {bugprone-unused-local-non-trivial-variable.IncludeTypes: '::async::Foo'}}" \
3+
// RUN: --
4+
// RUN: %check_clang_tidy -std=c++26 %s bugprone-unused-local-non-trivial-variable %t -- \
5+
// RUN: -config="{CheckOptions: {bugprone-unused-local-non-trivial-variable.IncludeTypes: '::async::Foo'}}" \
6+
// RUN: --
7+
8+
namespace async {
9+
class Foo {
10+
public:
11+
~Foo();
12+
private:
13+
};
14+
} // namespace async
15+
16+
void check() {
17+
async::Foo C;
18+
// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: unused local variable 'C' of type 'async::Foo' [bugprone-unused-local-non-trivial-variable]
19+
async::Foo _;
20+
// CHECK-MESSAGES-CXX23: :[[@LINE-1]]:14: warning: unused local variable '_' of type 'async::Foo' [bugprone-unused-local-non-trivial-variable]
21+
}

clang/docs/LibASTMatchersReference.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3462,6 +3462,21 @@ <h2 id="narrowing-matchers">Narrowing Matchers</h2>
34623462
</pre></td></tr>
34633463

34643464

3465+
<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1DependentNameType.html">DependentNameType</a>&gt;</td><td class="name" onclick="toggle('hasDependentName1')"><a name="hasDependentName1Anchor">hasDependentName</a></td><td>std::string N</td></tr>
3466+
<tr><td colspan="4" class="doc" id="hasDependentName1"><pre>Matches the dependent name of a DependentNameType.
3467+
3468+
Matches the dependent name of a DependentNameType
3469+
3470+
Given:
3471+
3472+
template &lt;typename T&lt; struct declToImport {
3473+
typedef typename T::type dependent_name;
3474+
};
3475+
3476+
dependentNameType(hasDependentName("type")) matches `T::type`
3477+
</pre></td></tr>
3478+
3479+
34653480
<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1CXXDependentScopeMemberExpr.html">CXXDependentScopeMemberExpr</a>&gt;</td><td class="name" onclick="toggle('memberHasSameNameAsBoundNode0')"><a name="memberHasSameNameAsBoundNode0Anchor">memberHasSameNameAsBoundNode</a></td><td>std::string BindingID</td></tr>
34663481
<tr><td colspan="4" class="doc" id="memberHasSameNameAsBoundNode0"><pre>Matches template-dependent, but known, member names against an already-bound
34673482
node

0 commit comments

Comments
 (0)