Skip to content

Commit db27c11

Browse files
authored
Merge branch 'main' into inbelic/dxil-cleanup
2 parents 71881fa + ba70368 commit db27c11

File tree

781 files changed

+25526
-12687
lines changed

Some content is hidden

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

781 files changed

+25526
-12687
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
container-name-tag: ${{ steps.vars.outputs.container-name-tag }}
2828
container-name-agent-tag: ${{ steps.vars.outputs.container-name-agent-tag }}
2929
container-filename: ${{ steps.vars.outputs.container-filename }}
30+
container-agent-filename: ${{ steps.vars.outputs.container-agent-filename }}
3031
steps:
3132
- name: Checkout LLVM
3233
uses: actions/checkout@v4
@@ -42,6 +43,7 @@ jobs:
4243
echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT
4344
echo "container-name-agent-tag=$container_name-agent:$tag" >> $GITHUB_OUTPUT
4445
echo "container-filename=$(echo $container_name:$tag | sed -e 's/\//-/g' -e 's/:/-/g').tar" >> $GITHUB_OUTPUT
46+
echo "container-agent-filename=$(echo $container_name-agent:$tag | sed -e 's/\//-/g' -e 's/:/-/g').tar" >> $GITHUB_OUTPUT
4547
- name: Build container
4648
working-directory: ./.github/workflows/containers/github-action-ci/
4749
run: |
@@ -53,13 +55,14 @@ jobs:
5355
# maintain minimal permissions while building the container.
5456
- name: Save container image
5557
run: |
56-
podman save ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name-agent-tag }} > ${{ steps.vars.outputs.container-filename }}
58+
podman save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }}
59+
podman save ${{ steps.vars.outputs.container-name-agent-tag }} > ${{ steps.vars.outputs.container-agent-filename }}
5760
5861
- name: Upload container image
5962
uses: actions/upload-artifact@v4
6063
with:
6164
name: container
62-
path: ${{ steps.vars.outputs.container-filename }}
65+
path: "*.tar"
6366
retention-days: 14
6467

6568
- name: Test Container
@@ -92,6 +95,7 @@ jobs:
9295
podman push ${{ needs.build-ci-container.outputs.container-name-tag }}
9396
podman push ${{ needs.build-ci-container.outputs.container-name }}:latest
9497
98+
podman load -i ${{ needs.build-ci-container.outputs.container-agent-filename }}
9599
podman tag ${{ needs.build-ci-container.outputs.container-name-agent-tag }} ${{ needs.build-ci-container.outputs.container-name-agent }}:latest
96100
podman push ${{ needs.build-ci-container.outputs.container-name-agent-tag }}
97101
podman push ${{ needs.build-ci-container.outputs.container-name-agent }}:latest

.github/workflows/premerge.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
pull_request:
88
paths:
99
- .github/workflows/premerge.yaml
10+
push:
11+
branches:
12+
- 'main'
1013

1114
jobs:
1215
premerge-checks-linux:

.github/workflows/release-binaries.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
prepare:
5050
name: Prepare to build binaries
5151
runs-on: ${{ inputs.runs-on }}
52-
if: github.repository == 'llvm/llvm-project'
52+
if: github.repository_owner == 'llvm'
5353
outputs:
5454
release-version: ${{ steps.vars.outputs.release-version }}
5555
ref: ${{ steps.vars.outputs.ref }}
@@ -177,7 +177,7 @@ jobs:
177177
build-release-package:
178178
name: "Build Release Package"
179179
needs: prepare
180-
if: github.repository == 'llvm/llvm-project'
180+
if: github.repository_owner == 'llvm'
181181
runs-on: ${{ needs.prepare.outputs.build-runs-on }}
182182
steps:
183183

@@ -327,7 +327,7 @@ jobs:
327327
- prepare
328328
- build-release-package
329329
if: >-
330-
github.repository == 'llvm/llvm-project'
330+
github.repository_owner == 'llvm'
331331
runs-on: ${{ needs.prepare.outputs.test-runs-on }}
332332
steps:
333333
- name: Checkout Actions

clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,29 @@ findMembersUsedInInitExpr(const CXXCtorInitializer *Initializer,
118118
return Results;
119119
}
120120

121+
/// Returns the start of the leading comments before `Loc`.
122+
static SourceLocation getStartOfLeadingComment(SourceLocation Loc,
123+
const SourceManager &SM,
124+
const LangOptions &LangOpts) {
125+
// We consider any leading comment token that is on the same line or
126+
// indented similarly to the first comment to be part of the leading comment.
127+
const unsigned Line = SM.getPresumedLineNumber(Loc);
128+
const unsigned Column = SM.getPresumedColumnNumber(Loc);
129+
std::optional<Token> Tok =
130+
Lexer::findPreviousToken(Loc, SM, LangOpts, /*IncludeComments=*/true);
131+
while (Tok && Tok->is(tok::comment)) {
132+
const SourceLocation CommentLoc =
133+
Lexer::GetBeginningOfToken(Tok->getLocation(), SM, LangOpts);
134+
if (SM.getPresumedLineNumber(CommentLoc) != Line &&
135+
SM.getPresumedColumnNumber(CommentLoc) != Column) {
136+
break;
137+
}
138+
Loc = CommentLoc;
139+
Tok = Lexer::findPreviousToken(Loc, SM, LangOpts, /*IncludeComments=*/true);
140+
}
141+
return Loc;
142+
}
143+
121144
/// Returns the end of the trailing comments after `Loc`.
122145
static SourceLocation getEndOfTrailingComment(SourceLocation Loc,
123146
const SourceManager &SM,
@@ -159,6 +182,7 @@ static SourceRange getFullFieldSourceRange(const FieldDecl &Field,
159182
if (CurrentToken->is(tok::semi))
160183
break;
161184
}
185+
Begin = getStartOfLeadingComment(Begin, SM, LangOpts);
162186
End = getEndOfTrailingComment(End, SM, LangOpts);
163187
return SourceRange(Begin, End);
164188
}

clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "clang/AST/ASTContext.h"
1111
#include "clang/AST/Decl.h"
1212
#include "clang/ASTMatchers/ASTMatchFinder.h"
13+
#include "clang/ASTMatchers/ASTMatchers.h"
1314
#include "clang/Lex/Lexer.h"
1415

1516
using namespace clang::ast_matchers;

clang-tools-extra/clang-tidy/modernize/UseIntegerSignComparisonCheck.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,13 @@ UseIntegerSignComparisonCheck::UseIntegerSignComparisonCheck(
8080
: ClangTidyCheck(Name, Context),
8181
IncludeInserter(Options.getLocalOrGlobal("IncludeStyle",
8282
utils::IncludeSorter::IS_LLVM),
83-
areDiagsSelfContained()) {}
83+
areDiagsSelfContained()),
84+
EnableQtSupport(Options.get("EnableQtSupport", false)) {}
8485

8586
void UseIntegerSignComparisonCheck::storeOptions(
8687
ClangTidyOptions::OptionMap &Opts) {
8788
Options.store(Opts, "IncludeStyle", IncludeInserter.getStyle());
89+
Options.store(Opts, "EnableQtSupport", EnableQtSupport);
8890
}
8991

9092
void UseIntegerSignComparisonCheck::registerMatchers(MatchFinder *Finder) {
@@ -154,8 +156,17 @@ void UseIntegerSignComparisonCheck::check(
154156
DiagnosticBuilder Diag =
155157
diag(BinaryOp->getBeginLoc(),
156158
"comparison between 'signed' and 'unsigned' integers");
157-
const std::string CmpNamespace = ("std::" + parseOpCode(OpCode)).str();
158-
const std::string CmpHeader = "<utility>";
159+
std::string CmpNamespace;
160+
llvm::StringRef CmpHeader;
161+
162+
if (getLangOpts().CPlusPlus20) {
163+
CmpHeader = "<utility>";
164+
CmpNamespace = llvm::Twine("std::" + parseOpCode(OpCode)).str();
165+
} else if (getLangOpts().CPlusPlus17 && EnableQtSupport) {
166+
CmpHeader = "<QtCore/q20utility.h>";
167+
CmpNamespace = llvm::Twine("q20::" + parseOpCode(OpCode)).str();
168+
}
169+
159170
// Prefer modernize-use-integer-sign-comparison when C++20 is available!
160171
Diag << FixItHint::CreateReplacement(
161172
CharSourceRange(R1, SubExprLHS != nullptr),

clang-tools-extra/clang-tidy/modernize/UseIntegerSignComparisonCheck.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ class UseIntegerSignComparisonCheck : public ClangTidyCheck {
3030
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
3131
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
3232
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
33-
return LangOpts.CPlusPlus20;
33+
return LangOpts.CPlusPlus20 || (LangOpts.CPlusPlus17 && EnableQtSupport);
3434
}
3535

3636
private:
3737
utils::IncludeInserter IncludeInserter;
38+
const bool EnableQtSupport;
3839
};
3940

4041
} // namespace clang::tidy::modernize

clang-tools-extra/clang-tidy/utils/LexerUtils.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,16 @@ namespace clang::tidy::utils::lexer {
1717
std::pair<Token, SourceLocation>
1818
getPreviousTokenAndStart(SourceLocation Location, const SourceManager &SM,
1919
const LangOptions &LangOpts, bool SkipComments) {
20-
Token Token;
21-
Token.setKind(tok::unknown);
20+
const std::optional<Token> Tok =
21+
Lexer::findPreviousToken(Location, SM, LangOpts, !SkipComments);
2222

23-
Location = Location.getLocWithOffset(-1);
24-
if (Location.isInvalid())
25-
return {Token, Location};
26-
27-
const auto StartOfFile = SM.getLocForStartOfFile(SM.getFileID(Location));
28-
while (Location != StartOfFile) {
29-
Location = Lexer::GetBeginningOfToken(Location, SM, LangOpts);
30-
if (!Lexer::getRawToken(Location, Token, SM, LangOpts) &&
31-
(!SkipComments || !Token.is(tok::comment))) {
32-
break;
33-
}
34-
if (Location == StartOfFile)
35-
return {Token, Location};
36-
Location = Location.getLocWithOffset(-1);
23+
if (Tok.has_value()) {
24+
return {*Tok, Lexer::GetBeginningOfToken(Tok->getLocation(), SM, LangOpts)};
3725
}
38-
return {Token, Location};
26+
27+
Token Token;
28+
Token.setKind(tok::unknown);
29+
return {Token, SourceLocation()};
3930
}
4031

4132
Token getPreviousToken(SourceLocation Location, const SourceManager &SM,

clang-tools-extra/clangd/GlobalCompilationDatabase.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,16 @@ bool OverlayCDB::setCompileCommand(PathRef File,
830830
return true;
831831
}
832832

833+
std::unique_ptr<ProjectModules>
834+
OverlayCDB::getProjectModules(PathRef File) const {
835+
auto MDB = DelegatingCDB::getProjectModules(File);
836+
MDB->setCommandMangler([&Mangler = Mangler](tooling::CompileCommand &Command,
837+
PathRef CommandPath) {
838+
Mangler(Command, CommandPath);
839+
});
840+
return MDB;
841+
}
842+
833843
DelegatingCDB::DelegatingCDB(const GlobalCompilationDatabase *Base)
834844
: Base(Base) {
835845
if (Base)

clang-tools-extra/clangd/GlobalCompilationDatabase.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ class OverlayCDB : public DelegatingCDB {
209209
setCompileCommand(PathRef File,
210210
std::optional<tooling::CompileCommand> CompilationCommand);
211211

212+
std::unique_ptr<ProjectModules>
213+
getProjectModules(PathRef File) const override;
214+
212215
private:
213216
mutable std::mutex Mutex;
214217
llvm::StringMap<tooling::CompileCommand> Commands; /* GUARDED_BY(Mut) */

0 commit comments

Comments
 (0)