Skip to content

Commit 0898ac2

Browse files
rebase on top of main
2 parents b880ee3 + 8d29a3b commit 0898ac2

File tree

752 files changed

+30416
-21962
lines changed

Some content is hidden

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

752 files changed

+30416
-21962
lines changed

.github/new-prs-labeler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,8 +1096,8 @@ clang:openmp:
10961096
- llvm/test/Transforms/OpenMP/**
10971097

10981098
clang:temporal-safety:
1099-
- clang/include/clang/Analysis/Analyses/LifetimeSafety*
1100-
- clang/lib/Analysis/LifetimeSafety*
1099+
- clang/include/clang/Analysis/Analyses/LifetimeSafety/**
1100+
- clang/lib/Analysis/LifetimeSafety/**
11011101
- clang/unittests/Analysis/LifetimeSafety*
11021102
- clang/test/Sema/*lifetime-safety*
11031103
- clang/test/Sema/*lifetime-analysis*

.github/workflows/build-ci-container-tooling.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
- name: Test Container
7373
run: |
7474
# Use --pull=never to ensure we are testing the just built image.
75-
podman run --pull=never --rm -it ${{ steps.vars.outputs.container-name-format-tag }} /usr/bin/bash -x -c 'cd $HOME && clang-format --version | grep version && black --version | grep black'
75+
podman run --pull=never --rm -it ${{ steps.vars.outputs.container-name-format-tag }} /usr/bin/bash -x -c 'cd $HOME && clang-format --version | grep version && git-clang-format -h | grep usage && black --version | grep black'
7676
podman run --pull=never --rm -it ${{ steps.vars.outputs.container-name-lint-tag }} /usr/bin/bash -x -c 'cd $HOME && clang-tidy --version | grep version && clang-tidy-diff.py -h | grep usage'
7777
7878
push-ci-container:

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ RUN apt-get update && \
1010
tar -xvJf llvm.tar.xz -C /llvm-extract \
1111
# Only unpack these tools to save space on Github runner.
1212
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
13-
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format && \
13+
LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format \
14+
LLVM-${LLVM_VERSION}-Linux-X64/bin/git-clang-format && \
1415
rm llvm.tar.xz
1516

1617

@@ -35,7 +36,9 @@ RUN apt-get update && \
3536
FROM base AS ci-container-code-format
3637
ARG LLVM_VERSION
3738

38-
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format ${LLVM_SYSROOT}/bin/clang-format
39+
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format \
40+
/llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/git-clang-format \
41+
${LLVM_SYSROOT}/bin/
3942

4043
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
4144

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ RUN apt-get update && \
6262
# Having a symlink from python to python3 enables code sharing between
6363
# the Linux and Windows pipelines.
6464
python3-pip \
65-
python3-venv \
6665
file \
6766
tzdata \
6867
python-is-python3 && \

clang-tools-extra/clang-doc/JSONGenerator.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,12 +584,20 @@ static SmallString<16> determineFileName(Info *I, SmallString<128> &Path) {
584584
FileName = RecordSymbolInfo->MangledName;
585585
} else if (I->USR == GlobalNamespaceID)
586586
FileName = "index";
587-
else
587+
else if (I->IT == InfoType::IT_namespace) {
588+
for (const auto &NS : I->Namespace) {
589+
FileName += NS.Name;
590+
FileName += "_";
591+
}
592+
FileName += I->Name;
593+
} else
588594
FileName = I->Name;
589595
sys::path::append(Path, FileName + ".json");
590596
return FileName;
591597
}
592598

599+
// FIXME: Revert back to creating nested directories for namespaces instead of
600+
// putting everything in a flat directory structure.
593601
Error JSONGenerator::generateDocs(
594602
StringRef RootDir, llvm::StringMap<std::unique_ptr<doc::Info>> Infos,
595603
const ClangDocContext &CDCtx) {

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,21 @@ SuspiciousIncludeCheck::SuspiciousIncludeCheck(StringRef Name,
4040
ClangTidyContext *Context)
4141
: ClangTidyCheck(Name, Context),
4242
HeaderFileExtensions(Context->getHeaderFileExtensions()),
43-
ImplementationFileExtensions(Context->getImplementationFileExtensions()) {
44-
}
43+
ImplementationFileExtensions(Context->getImplementationFileExtensions()),
44+
IgnoredRegexString(Options.get("IgnoredRegex").value_or(StringRef{})),
45+
IgnoredRegex(IgnoredRegexString) {}
4546

4647
void SuspiciousIncludeCheck::registerPPCallbacks(
4748
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
4849
PP->addPPCallbacks(
4950
::std::make_unique<SuspiciousIncludePPCallbacks>(*this, SM, PP));
5051
}
5152

53+
void SuspiciousIncludeCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
54+
if (!IgnoredRegexString.empty())
55+
Options.store(Opts, "IgnoredRegex", IgnoredRegexString);
56+
}
57+
5258
void SuspiciousIncludePPCallbacks::InclusionDirective(
5359
SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName,
5460
bool IsAngled, CharSourceRange FilenameRange, OptionalFileEntryRef File,
@@ -57,6 +63,9 @@ void SuspiciousIncludePPCallbacks::InclusionDirective(
5763
if (IncludeTok.getIdentifierInfo()->getPPKeywordID() == tok::pp_import)
5864
return;
5965

66+
if (!Check.IgnoredRegexString.empty() && Check.IgnoredRegex.match(FileName))
67+
return;
68+
6069
SourceLocation DiagLoc = FilenameRange.getBegin().getLocWithOffset(1);
6170

6271
const std::optional<StringRef> IFE =

clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SUSPICIOUSINCLUDECHECK_H
1111

1212
#include "../ClangTidyCheck.h"
13-
#include "../utils/FileExtensionsUtils.h"
1413

1514
namespace clang::tidy::bugprone {
1615

@@ -28,9 +27,12 @@ class SuspiciousIncludeCheck : public ClangTidyCheck {
2827
SuspiciousIncludeCheck(StringRef Name, ClangTidyContext *Context);
2928
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
3029
Preprocessor *ModuleExpanderPP) override;
30+
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
3131

3232
FileExtensionsSet HeaderFileExtensions;
3333
FileExtensionsSet ImplementationFileExtensions;
34+
StringRef IgnoredRegexString;
35+
llvm::Regex IgnoredRegex;
3436
};
3537

3638
} // namespace clang::tidy::bugprone

clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ static void fixGenericExprCastToBool(DiagnosticBuilder &Diag,
8989

9090
const Expr *SubExpr = Cast->getSubExpr();
9191

92-
bool NeedInnerParens = utils::fixit::areParensNeededForStatement(*SubExpr);
92+
bool NeedInnerParens =
93+
utils::fixit::areParensNeededForStatement(*SubExpr->IgnoreImpCasts());
9394
bool NeedOuterParens =
9495
Parent != nullptr && utils::fixit::areParensNeededForStatement(*Parent);
9596

clang-tools-extra/clangd/ClangdLSPServer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ CodeAction toCodeAction(const ClangdServer::CodeActionResult::Rename &R,
8181
const URIForFile &File) {
8282
CodeAction CA;
8383
CA.title = R.FixMessage;
84-
CA.kind = std::string(CodeAction::REFACTOR_KIND);
84+
CA.kind = std::string(CodeAction::QUICKFIX_KIND);
8585
CA.command.emplace();
8686
CA.command->title = R.FixMessage;
8787
CA.command->command = std::string(ApplyRenameCommand);

clang-tools-extra/clangd/FindTarget.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,16 +1040,11 @@ class ExplicitReferenceCollector
10401040
if (auto *S = N.get<Stmt>())
10411041
return refInStmt(S, Resolver);
10421042
if (auto *NNSL = N.get<NestedNameSpecifierLoc>()) {
1043+
if (auto TL = NNSL->getAsTypeLoc())
1044+
return refInTypeLoc(NNSL->getAsTypeLoc(), Resolver);
10431045
// (!) 'DeclRelation::Alias' ensures we do not lose namespace aliases.
1044-
NestedNameSpecifierLoc Qualifier;
1045-
SourceLocation NameLoc;
1046-
if (auto TL = NNSL->getAsTypeLoc()) {
1047-
Qualifier = TL.getPrefix();
1048-
NameLoc = TL.getNonPrefixBeginLoc();
1049-
} else {
1050-
Qualifier = NNSL->getAsNamespaceAndPrefix().Prefix;
1051-
NameLoc = NNSL->getLocalBeginLoc();
1052-
}
1046+
NestedNameSpecifierLoc Qualifier = NNSL->getAsNamespaceAndPrefix().Prefix;
1047+
SourceLocation NameLoc = NNSL->getLocalBeginLoc();
10531048
return {
10541049
ReferenceLoc{Qualifier, NameLoc, false,
10551050
explicitReferenceTargets(

0 commit comments

Comments
 (0)