Skip to content

Commit

Permalink
merge main into amd-stg-open
Browse files Browse the repository at this point in the history
Change-Id: Id60c4982e4e292d09255560145fdef33a1060e55
  • Loading branch information
ronlieb committed Nov 2, 2023
2 parents 2b69d00 + b90cfe4 commit 1e0936e
Show file tree
Hide file tree
Showing 538 changed files with 17,656 additions and 15,270 deletions.
58 changes: 19 additions & 39 deletions .github/workflows/new-prs.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,36 @@
name: "Labelling new pull requests"

permissions:
contents: read

on:
workflow_run:
workflows: ["PR Receive"]
# It's safe to use pull_request_target here, because we aren't checking out
# code from the pull request branch.
# See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
pull_request_target:
types:
- opened
- reopened
- ready_for_review
- synchronize

jobs:
automate-prs-labels:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
# Ignore PRs with more than 10 commits. Pull requests with a lot of
# commits tend to be accidents usually when someone made a mistake while trying
# to rebase. We want to ignore these pull requests to avoid excessive
# notifications.
if: >
github.repository == 'llvm/llvm-project' &&
github.event.workflow_run.event == 'pull_request_target' &&
github.event.workflow_run.conclusion == 'success'
github.event.pull_request.draft == false &&
github.event.pull_request.commits < 10
steps:
# From: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
# Updated version here: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
- name: Debug
run: |
echo "Event: ${{ github.event.workflow_run.event }} Conclusion: ${{ github.event.workflow_run.conclusion }}"
- name: 'Download artifact'
uses: actions/github-script@v6
with:
script: |
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id
});
const matchArtifact = artifacts.data.artifacts.find((artifact) =>
artifact.name === 'pr'
);
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip'
});
const { writeFileSync } = require('node:fs');
writeFileSync('${{ github.workspace }}/pr.zip', Buffer.from(download.data));
- run: unzip pr.zip

- name: "Get PR Number"
id: vars
run:
echo "pr-number=$(cat NR)" >> "$GITHUB_OUTPUT"

- uses: actions/labeler@v4
with:
configuration-path: .github/new-prs-labeler.yml
# workaround for https://github.com/actions/labeler/issues/112
sync-labels: ''
repo-token: ${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}
pr-number: ${{ steps.vars.outputs.pr-number }}
26 changes: 0 additions & 26 deletions .github/workflows/pr-receive-label.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/pr-receive.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/pr-subscriber-wait.py

This file was deleted.

52 changes: 5 additions & 47 deletions .github/workflows/pr-subscriber.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
name: PR Subscriber

on:
workflow_run:
workflows: ["PR Receive Label"]
pull_request_target:
types:
- completed
- labeled

permissions:
actions: read
contents: read

jobs:
auto-subscribe:
runs-on: ubuntu-latest
if: >
github.repository == 'llvm/llvm-project' &&
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
if: github.repository == 'llvm/llvm-project'
steps:
- name: Setup Automation Script
run: |
Expand All @@ -26,47 +21,10 @@ jobs:
chmod a+x github-automation.py
pip install -r requirements.txt
- name: 'Wait for other actions'
# We can't use the concurrency tag for these jobs, because it will
# cancel pending jobs if another job is running.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python3 pr-subscriber-wait.py
# From: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
# Updated version here: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
- name: 'Download artifact'
uses: actions/github-script@v6
with:
script: |
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id
});
const matchArtifact = artifacts.data.artifacts.find((artifact) =>
artifact.name === 'pr'
);
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip'
});
const { writeFileSync } = require('node:fs');
writeFileSync('${{ github.workspace }}/pr.zip', Buffer.from(download.data));
- run: unzip pr.zip

- name: Update watchers
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
run: |
PR_NUMBER=$(cat NR)
LABEL_NAME=$(cat LABEL)
./github-automation.py \
--token '${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}' \
pr-subscriber \
--issue-number "$PR_NUMBER" \
--label-name "$LABEL_NAME"
--issue-number "${{ github.event.number }}" \
--label-name "${{ github.event.label.name }}"
4 changes: 1 addition & 3 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ on:
# To guarantee Maintained check is occasionally updated. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
schedule:
- cron: '38 20 * * 4'
push:
branches: [ "main" ]
- cron: '38 20 * * *'

# Declare default permissions as read only.
permissions:
Expand Down
5 changes: 0 additions & 5 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -723,11 +723,6 @@ Bug Fixes to C++ Support
declaration definition. Fixes:
(`#61763 <https://github.com/llvm/llvm-project/issues/61763>`_)

- Fix a bug where implicit deduction guides are not correctly generated for nested template
classes. Fixes:
(`#46200 <https://github.com/llvm/llvm-project/issues/46200>`_)
(`#57812 <https://github.com/llvm/llvm-project/issues/57812>`_)

- Diagnose use of a variable-length array in a coroutine. The design of
coroutines is such that it is not possible to support VLA use. Fixes:
(`#65858 <https://github.com/llvm/llvm-project/issues/65858>`_)
Expand Down
5 changes: 5 additions & 0 deletions clang/include/clang/Basic/DiagnosticLexKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,11 @@ def err_header_import_semi_in_macro : Error<
def err_header_import_not_header_unit : Error<
"header file %0 (aka '%1') cannot be imported because "
"it is not known to be a header unit">;
def warn_pp_include_angled_in_module_purview : Warning<
"'#include <filename>' attaches the declarations to the named module '%0'"
", which is not usually intended; consider moving that directive before "
"the module declaration">,
InGroup<DiagGroup<"include-angled-in-module-purview">>;

def warn_header_guard : Warning<
"%0 is used as a header guard here, followed by #define of a different macro">,
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/Driver/Distro.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class Distro {
UbuntuKinetic,
UbuntuLunar,
UbuntuMantic,
UbuntuNoble,
UnknownDistro
};

Expand Down Expand Up @@ -129,7 +130,7 @@ class Distro {
}

bool IsUbuntu() const {
return DistroVal >= UbuntuHardy && DistroVal <= UbuntuMantic;
return DistroVal >= UbuntuHardy && DistroVal <= UbuntuNoble;
}

bool IsAlpineLinux() const { return DistroVal == AlpineLinux; }
Expand Down
7 changes: 4 additions & 3 deletions clang/lib/Basic/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ bool Module::isForBuilding(const LangOptions &LangOpts) const {
StringRef TopLevelName = getTopLevelModuleName();
StringRef CurrentModule = LangOpts.CurrentModule;

// When building framework Foo, we want to make sure that Foo *and*
// Foo_Private are textually included and no modules are built for both.
if (getTopLevelModule()->IsFramework &&
// When building the implementation of framework Foo, we want to make sure
// that Foo *and* Foo_Private are textually included and no modules are built
// for either.
if (!LangOpts.isCompilingModule() && getTopLevelModule()->IsFramework &&
CurrentModule == LangOpts.ModuleName &&
!CurrentModule.endswith("_Private") && TopLevelName.endswith("_Private"))
TopLevelName = TopLevelName.drop_back(8);
Expand Down
17 changes: 8 additions & 9 deletions clang/lib/CodeGen/CGBlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM,
// Signature. Mandatory ObjC-style method descriptor @encode sequence.
std::string typeAtEncoding =
CGM.getContext().getObjCEncodingForBlock(blockInfo.getBlockExpr());
elements.add(llvm::ConstantExpr::getBitCast(
CGM.GetAddrOfConstantCString(typeAtEncoding).getPointer(), i8p));
elements.add(CGM.GetAddrOfConstantCString(typeAtEncoding).getPointer());

// GC layout.
if (C.getLangOpts().ObjC) {
Expand Down Expand Up @@ -809,7 +808,7 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) {
llvm::Constant *blockISA = blockInfo.NoEscape
? CGM.getNSConcreteGlobalBlock()
: CGM.getNSConcreteStackBlock();
isa = llvm::ConstantExpr::getBitCast(blockISA, VoidPtrTy);
isa = blockISA;

// Build the block descriptor.
descriptor = buildBlockDescriptor(CGM, blockInfo);
Expand Down Expand Up @@ -1869,7 +1868,7 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {
CaptureStrKind::CopyHelper, CGM);

if (llvm::GlobalValue *Func = CGM.getModule().getNamedValue(FuncName))
return llvm::ConstantExpr::getBitCast(Func, VoidPtrTy);
return Func;

ASTContext &C = getContext();

Expand Down Expand Up @@ -1990,7 +1989,7 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {

FinishFunction();

return llvm::ConstantExpr::getBitCast(Fn, VoidPtrTy);
return Fn;
}

static BlockFieldFlags
Expand Down Expand Up @@ -2056,7 +2055,7 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) {
CaptureStrKind::DisposeHelper, CGM);

if (llvm::GlobalValue *Func = CGM.getModule().getNamedValue(FuncName))
return llvm::ConstantExpr::getBitCast(Func, VoidPtrTy);
return Func;

ASTContext &C = getContext();

Expand Down Expand Up @@ -2113,7 +2112,7 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) {

FinishFunction();

return llvm::ConstantExpr::getBitCast(Fn, VoidPtrTy);
return Fn;
}

namespace {
Expand Down Expand Up @@ -2352,7 +2351,7 @@ generateByrefCopyHelper(CodeGenFunction &CGF, const BlockByrefInfo &byrefInfo,

CGF.FinishFunction();

return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy);
return Fn;
}

/// Build the copy helper for a __block variable.
Expand Down Expand Up @@ -2408,7 +2407,7 @@ generateByrefDisposeHelper(CodeGenFunction &CGF,

CGF.FinishFunction();

return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy);
return Fn;
}

/// Build the dispose helper for a __block variable.
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Driver/Distro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ static Distro::DistroType DetectLsbRelease(llvm::vfs::FileSystem &VFS) {
.Case("kinetic", Distro::UbuntuKinetic)
.Case("lunar", Distro::UbuntuLunar)
.Case("mantic", Distro::UbuntuMantic)
.Case("noble", Distro::UbuntuNoble)
.Default(Distro::UnknownDistro);
return Version;
}
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/Lex/PPDirectives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2537,6 +2537,10 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport(
return {ImportAction::None};
}

if (isAngled && isInNamedModule())
Diag(FilenameTok, diag::warn_pp_include_angled_in_module_purview)
<< getNamedModuleName();

// Look up the file, create a File ID for it.
SourceLocation IncludePos = FilenameTok.getLocation();
// If the filename string was the result of macro expansions, set the include
Expand Down
Loading

0 comments on commit 1e0936e

Please sign in to comment.