Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cf9a727

Browse filesBrowse files
authored
Merge branch 'main' into users/kparzysz/spr/m03-meta-simple
2 parents e8adf97 + 70e96dc commit cf9a727
Copy full SHA for cf9a727

File tree

Expand file treeCollapse file tree

863 files changed

+63365
-32419
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

863 files changed

+63365
-32419
lines changed

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

Copy file name to clipboardExpand all lines: .github/workflows/containers/github-action-ci/Dockerfile
+17Lines 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/hlsl-matrix.yaml

Copy file name to clipboard
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: HLSL Tests
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
pull_request:
9+
branches:
10+
- main
11+
paths:
12+
- llvm/**/DirectX/**
13+
- .github/workflows/hlsl*
14+
- clang/*HLSL*/**/*
15+
- clang/**/*HLSL*
16+
- llvm/**/Frontend/HLSL/**/*
17+
18+
jobs:
19+
HLSL-Tests:
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
runs-on:
24+
- hlsl-macos
25+
26+
uses: ./.github/workflows/hlsl-test-all.yaml
27+
with:
28+
SKU: hlsl-macos
29+
TestTarget: check-hlsl-clang-mtl # TODO: This target changes based on SKU
30+
LLVM-ref: ${{ github.ref }}

‎.github/workflows/hlsl-test-all.yaml

Copy file name to clipboard
+87Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: HLSL Test
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
OffloadTest-branch:
10+
description: 'Test Suite Branch'
11+
required: false
12+
default: 'main'
13+
type: string
14+
LLVM-ref:
15+
description: 'LLVM Branch'
16+
required: false
17+
default: 'main'
18+
type: string
19+
SKU:
20+
required: true
21+
type: string
22+
TestTarget:
23+
required: false
24+
default: 'check-hlsl'
25+
type: string
26+
27+
jobs:
28+
build:
29+
runs-on: ${{ inputs.SKU }}
30+
steps:
31+
- name: Checkout DXC
32+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
33+
with:
34+
repository: Microsoft/DirectXShaderCompiler
35+
ref: main
36+
path: DXC
37+
submodules: true
38+
- name: Checkout LLVM
39+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
40+
with:
41+
ref: ${{ inputs.LLVM-branch }}
42+
path: llvm-project
43+
- name: Checkout OffloadTest
44+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
45+
with:
46+
repository: llvm-beanz/offload-test-suite
47+
ref: main
48+
path: OffloadTest
49+
- name: Checkout Golden Images
50+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
51+
with:
52+
repository: llvm-beanz/offload-golden-images
53+
ref: main
54+
path: golden-images
55+
- name: Setup Windows
56+
if: runner.os == 'Windows'
57+
uses: llvm/actions/setup-windows@main
58+
with:
59+
arch: amd64
60+
- name: Build DXC
61+
run: |
62+
cd DXC
63+
mkdir build
64+
cd build
65+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -C ${{ github.workspace }}/DXC/cmake/caches/PredefinedParams.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DHLSL_DISABLE_SOURCE_GENERATION=On ${{ github.workspace }}/DXC/
66+
ninja dxv llvm-dis
67+
- name: Build LLVM
68+
run: |
69+
cd llvm-project
70+
mkdir build
71+
cd build
72+
cmake -G Ninja -DDXIL_DIS=${{ github.workspace }}/DXC/build/bin/llvm-dis -DLLVM_INCLUDE_DXIL_TESTS=On -DCMAKE_BUILD_TYPE=Release -C ${{ github.workspace }}/llvm-project/clang/cmake/caches/HLSL.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DDXC_DIR=${{ github.workspace }}/DXC/build/bin -DLLVM_EXTERNAL_OFFLOADTEST_SOURCE_DIR=${{ github.workspace }}/OffloadTest -DLLVM_EXTERNAL_PROJECTS="OffloadTest" -DLLVM_LIT_ARGS="--xunit-xml-output=testresults.xunit.xml -v" -DGOLDENIMAGE_DIR=${{ github.workspace }}/golden-images ${{ github.workspace }}/llvm-project/llvm/
73+
ninja hlsl-test-depends llvm-test-depends clang-test-depends
74+
- name: Run HLSL Tests
75+
run: |
76+
cd llvm-project
77+
cd build
78+
ninja check-llvm
79+
ninja check-clang
80+
ninja check-hlsl-unit
81+
ninja ${{ inputs.TestTarget }}
82+
- name: Publish Test Results
83+
uses: EnricoMi/publish-unit-test-result-action/macos@170bf24d20d201b842d7a52403b73ed297e6645b # v2
84+
if: always() && runner.os == 'macOS'
85+
with:
86+
comment_mode: off
87+
files: llvm-project/build/**/testresults.xunit.xml

‎.github/workflows/libclang-python-tests.yml

Copy file name to clipboardExpand all lines: .github/workflows/libclang-python-tests.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ jobs:
3737
projects: clang
3838
# There is an issue running on "windows-2019".
3939
# See https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082.
40-
os_list: '["ubuntu-latest"]'
40+
os_list: '["ubuntu-22.04"]'
4141
python_version: ${{ matrix.python-version }}

‎.github/workflows/llvm-project-tests.yml

Copy file name to clipboardExpand all lines: .github/workflows/llvm-project-tests.yml
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ on:
3939
type: string
4040
# Use windows-2019 due to:
4141
# https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317
42-
default: '["ubuntu-latest", "windows-2019", "macOS-13"]'
42+
# Use ubuntu-22.04 rather than ubuntu-latest to match the ubuntu
43+
# version in the CI container. Without this, setup-python tries
44+
# to install a python version linked against a newer version of glibc.
45+
# TODO(boomanaiden154): Bump the Ubuntu version once the version in the
46+
# container is bumped.
47+
default: '["ubuntu-22.04", "windows-2019", "macOS-13"]'
4348

4449
python_version:
4550
required: false
@@ -113,7 +118,8 @@ jobs:
113118
run: |
114119
if [ "${{ runner.os }}" == "Linux" ]; then
115120
builddir="/mnt/build/"
116-
mkdir -p $builddir
121+
sudo mkdir -p $builddir
122+
sudo chown gha $builddir
117123
extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
118124
else
119125
builddir="$(pwd)"/build

‎.github/workflows/premerge.yaml

Copy file name to clipboardExpand all lines: .github/workflows/premerge.yaml
+6Lines 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/ccache-action@v1.2.14
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/ClangTidyOptions.cpp

Copy file name to clipboardExpand all lines: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
+24-23Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -337,33 +337,34 @@ FileOptionsBaseProvider::FileOptionsBaseProvider(
337337
void FileOptionsBaseProvider::addRawFileOptions(
338338
llvm::StringRef AbsolutePath, std::vector<OptionsSource> &CurOptions) {
339339
auto CurSize = CurOptions.size();
340-
341340
// Look for a suitable configuration file in all parent directories of the
342341
// file. Start with the immediate parent directory and move up.
343-
StringRef Path = llvm::sys::path::parent_path(AbsolutePath);
344-
for (StringRef CurrentPath = Path; !CurrentPath.empty();
345-
CurrentPath = llvm::sys::path::parent_path(CurrentPath)) {
346-
std::optional<OptionsSource> Result;
347-
348-
auto Iter = CachedOptions.find(CurrentPath);
349-
if (Iter != CachedOptions.end())
350-
Result = Iter->second;
351-
352-
if (!Result)
353-
Result = tryReadConfigFile(CurrentPath);
354-
355-
if (Result) {
356-
// Store cached value for all intermediate directories.
357-
while (Path != CurrentPath) {
342+
StringRef RootPath = llvm::sys::path::parent_path(AbsolutePath);
343+
auto MemorizedConfigFile =
344+
[this, &RootPath](StringRef CurrentPath) -> std::optional<OptionsSource> {
345+
const auto Iter = CachedOptions.Memorized.find(CurrentPath);
346+
if (Iter != CachedOptions.Memorized.end())
347+
return CachedOptions.Storage[Iter->second];
348+
std::optional<OptionsSource> OptionsSource = tryReadConfigFile(CurrentPath);
349+
if (OptionsSource) {
350+
const size_t Index = CachedOptions.Storage.size();
351+
CachedOptions.Storage.emplace_back(OptionsSource.value());
352+
while (RootPath != CurrentPath) {
358353
LLVM_DEBUG(llvm::dbgs()
359-
<< "Caching configuration for path " << Path << ".\n");
360-
if (!CachedOptions.count(Path))
361-
CachedOptions[Path] = *Result;
362-
Path = llvm::sys::path::parent_path(Path);
354+
<< "Caching configuration for path " << RootPath << ".\n");
355+
CachedOptions.Memorized[RootPath] = Index;
356+
RootPath = llvm::sys::path::parent_path(RootPath);
363357
}
364-
CachedOptions[Path] = *Result;
365-
366-
CurOptions.push_back(*Result);
358+
CachedOptions.Memorized[CurrentPath] = Index;
359+
RootPath = llvm::sys::path::parent_path(CurrentPath);
360+
}
361+
return OptionsSource;
362+
};
363+
for (StringRef CurrentPath = RootPath; !CurrentPath.empty();
364+
CurrentPath = llvm::sys::path::parent_path(CurrentPath)) {
365+
if (std::optional<OptionsSource> Result =
366+
MemorizedConfigFile(CurrentPath)) {
367+
CurOptions.emplace_back(Result.value());
367368
if (!Result->first.InheritParentConfig.value_or(false))
368369
break;
369370
}

‎clang-tools-extra/clang-tidy/ClangTidyOptions.h

Copy file name to clipboardExpand all lines: clang-tools-extra/clang-tidy/ClangTidyOptions.h
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,10 @@ class FileOptionsBaseProvider : public DefaultOptionsProvider {
241241
/// \c ConfigHandlers.
242242
std::optional<OptionsSource> tryReadConfigFile(llvm::StringRef Directory);
243243

244-
llvm::StringMap<OptionsSource> CachedOptions;
244+
struct OptionsCache {
245+
llvm::StringMap<size_t> Memorized;
246+
llvm::SmallVector<OptionsSource, 4U> Storage;
247+
} CachedOptions;
245248
ClangTidyOptions OverrideOptions;
246249
ConfigFileHandlers ConfigHandlers;
247250
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS;

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

Copy file name to clipboardExpand all lines: clang-tools-extra/clang-tidy/bugprone/UnusedLocalNonTrivialVariableCheck.cpp
+4-2Lines changed: 4 additions & 2 deletions
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,9 +30,10 @@ static constexpr StringRef DefaultIncludeTypeRegex =
2930

3031
AST_MATCHER(VarDecl, isLocalVarDecl) { return Node.isLocalVarDecl(); }
3132
AST_MATCHER(VarDecl, isReferenced) { return Node.isReferenced(); }
32-
AST_MATCHER_P(VarDecl, explicitMarkUnused, LangOptions, LangOpts) {
33+
AST_MATCHER(VarDecl, explicitMarkUnused) {
3334
// Implementations should not emit a warning that a name-independent
3435
// declaration is used or unused.
36+
LangOptions const &LangOpts = Finder->getASTContext().getLangOpts();
3537
return Node.hasAttr<UnusedAttr>() ||
3638
(LangOpts.CPlusPlus26 && Node.isPlaceholderVar(LangOpts));
3739
}
@@ -66,7 +68,7 @@ void UnusedLocalNonTrivialVariableCheck::registerMatchers(MatchFinder *Finder) {
6668
varDecl(isLocalVarDecl(), unless(isReferenced()),
6769
unless(isExceptionVariable()), hasLocalStorage(), isDefinition(),
6870
unless(hasType(isReferenceType())), unless(hasType(isTrivial())),
69-
unless(explicitMarkUnused(getLangOpts())),
71+
unless(explicitMarkUnused()),
7072
hasType(hasUnqualifiedDesugaredType(
7173
anyOf(recordType(hasDeclaration(namedDecl(
7274
matchesAnyListedName(IncludeTypes),

‎clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp

Copy file name to clipboardExpand all lines: clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
#include "UnusedParametersCheck.h"
1010
#include "clang/AST/ASTContext.h"
1111
#include "clang/AST/ASTLambda.h"
12+
#include "clang/AST/Attr.h"
13+
#include "clang/AST/Decl.h"
1214
#include "clang/AST/RecursiveASTVisitor.h"
1315
#include "clang/ASTMatchers/ASTMatchFinder.h"
16+
#include "clang/Basic/SourceManager.h"
1417
#include "clang/Lex/Lexer.h"
1518
#include "llvm/ADT/STLExtras.h"
1619
#include <unordered_map>
@@ -26,6 +29,17 @@ bool isOverrideMethod(const FunctionDecl *Function) {
2629
return MD->size_overridden_methods() > 0 || MD->hasAttr<OverrideAttr>();
2730
return false;
2831
}
32+
33+
bool hasAttrAfterParam(const SourceManager *SourceManager,
34+
const ParmVarDecl *Param) {
35+
for (const auto *Attr : Param->attrs()) {
36+
if (SourceManager->isBeforeInTranslationUnit(Param->getLocation(),
37+
Attr->getLocation())) {
38+
return true;
39+
}
40+
}
41+
return false;
42+
}
2943
} // namespace
3044

3145
void UnusedParametersCheck::registerMatchers(MatchFinder *Finder) {
@@ -189,6 +203,11 @@ void UnusedParametersCheck::check(const MatchFinder::MatchResult &Result) {
189203
if (Param->isUsed() || Param->isReferenced() || !Param->getDeclName() ||
190204
Param->hasAttr<UnusedAttr>())
191205
continue;
206+
if (hasAttrAfterParam(Result.SourceManager, Param)) {
207+
// Due to how grammar works, attributes would be wrongly applied to the
208+
// type if we remove the preceding parameter name.
209+
continue;
210+
}
192211

193212
// In non-strict mode ignore function definitions with empty bodies
194213
// (constructor initializer counts for non-empty body).

‎clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp

Copy file name to clipboardExpand all lines: clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void UseInternalLinkageCheck::registerMatchers(MatchFinder *Finder) {
125125
exportDecl()))))));
126126
Finder->addMatcher(
127127
functionDecl(Common, hasBody(),
128-
unless(anyOf(cxxMethodDecl(),
128+
unless(anyOf(cxxMethodDecl(), isConsteval(),
129129
isAllocationOrDeallocationOverloadedFunction(),
130130
isMain())))
131131
.bind("fn"),

‎clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp

Copy file name to clipboardExpand all lines: clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static bool maxCondition(const BinaryOperator::Opcode Op, const Expr *CondLhs,
5959
return false;
6060
}
6161

62-
QualType getNonTemplateAlias(QualType QT) {
62+
static QualType getNonTemplateAlias(QualType QT) {
6363
while (true) {
6464
// cast to a TypedefType
6565
if (const TypedefType *TT = dyn_cast<TypedefType>(QT)) {
@@ -92,15 +92,15 @@ static std::string createReplacement(const Expr *CondLhs, const Expr *CondRhs,
9292
const llvm::StringRef AssignLhsStr = Lexer::getSourceText(
9393
Source.getExpansionRange(AssignLhs->getSourceRange()), Source, LO);
9494

95-
clang::QualType GlobalImplicitCastType;
96-
clang::QualType LhsType = CondLhs->getType()
97-
.getCanonicalType()
98-
.getNonReferenceType()
99-
.getUnqualifiedType();
100-
clang::QualType RhsType = CondRhs->getType()
101-
.getCanonicalType()
102-
.getNonReferenceType()
103-
.getUnqualifiedType();
95+
QualType GlobalImplicitCastType;
96+
QualType LhsType = CondLhs->getType()
97+
.getCanonicalType()
98+
.getNonReferenceType()
99+
.getUnqualifiedType();
100+
QualType RhsType = CondRhs->getType()
101+
.getCanonicalType()
102+
.getNonReferenceType()
103+
.getUnqualifiedType();
104104
if (LhsType != RhsType) {
105105
GlobalImplicitCastType = getNonTemplateAlias(BO->getLHS()->getType());
106106
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.