Skip to content

Commit 2437859

Browse files
authored
Merge branch 'main' into move-test
2 parents 878c50d + c0e4bce commit 2437859

35 files changed

+878
-471
lines changed

.ci/all_requirements.txt

Lines changed: 2 additions & 192 deletions
Large diffs are not rendered by default.

.ci/premerge_advisor_explain.py

Lines changed: 3 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -4,83 +4,20 @@
44
"""Script for getting explanations from the premerge advisor."""
55

66
import argparse
7+
import os
78
import platform
89
import sys
9-
import json
1010

1111
import requests
12-
import github
13-
import github.PullRequest
1412

1513
import generate_test_report_lib
1614

1715
PREMERGE_ADVISOR_URL = (
1816
"http://premerge-advisor.premerge-advisor.svc.cluster.local:5000/explain"
1917
)
20-
COMMENT_TAG = "<!--PREMERGE ADVISOR COMMENT: {platform}-->"
2118

2219

23-
def get_comment_id(platform: str, pr: github.PullRequest.PullRequest) -> int | None:
24-
platform_comment_tag = COMMENT_TAG.format(platform=platform)
25-
for comment in pr.as_issue().get_comments():
26-
if platform_comment_tag in comment.body:
27-
return comment.id
28-
return None
29-
30-
31-
def get_comment(
32-
github_token: str,
33-
pr_number: int,
34-
body: str,
35-
) -> dict[str, str]:
36-
repo = github.Github(github_token).get_repo("llvm/llvm-project")
37-
pr = repo.get_issue(pr_number).as_pull_request()
38-
comment = {"body": body}
39-
comment_id = get_comment_id(platform.system(), pr)
40-
if comment_id:
41-
comment["id"] = comment_id
42-
43-
44-
def main(
45-
commit_sha: str,
46-
build_log_files: list[str],
47-
github_token: str,
48-
pr_number: int,
49-
return_code: int,
50-
):
51-
"""The main entrypoint for the script.
52-
53-
This function parses failures from files, requests information from the
54-
premerge advisor, and may write a Github comment depending upon the output.
55-
There are four different scenarios:
56-
1. There has never been a previous failure and the job passes - We do not
57-
create a comment. We write out an empty file to the comment path so the
58-
issue-write workflow knows not to create anything.
59-
2. There has never been a previous failure and the job fails - We create a
60-
new comment containing the failure information and any possible premerge
61-
advisor findings.
62-
3. There has been a previous failure and the job passes - We update the
63-
existing comment by passing its ID and a passed message to the
64-
issue-write workflow.
65-
4. There has been a previous failure and the job fails - We update the
66-
existing comment in the same manner as above, but generate the comment
67-
as if we have a failure.
68-
69-
Args:
70-
commit_sha: The base commit SHA for this PR run.
71-
build_log_files: The list of JUnit XML files and ninja logs.
72-
github_token: The token to use to access the Github API.
73-
pr_number: The number of the PR associated with this run.
74-
return_code: The numerical return code of ninja/CMake.
75-
"""
76-
if return_code == 0:
77-
with open("comment", "w") as comment_file_handle:
78-
comment = get_comment(
79-
":white_check_mark: With the latest revision this PR passed "
80-
"the premerge checks."
81-
)
82-
if comment["id"]:
83-
json.dump([comment], comment_file_handle)
20+
def main(commit_sha: str, build_log_files: list[str]):
8421
junit_objects, ninja_logs = generate_test_report_lib.load_info_from_files(
8522
build_log_files
8623
)
@@ -108,31 +45,13 @@ def main(
10845
)
10946
if advisor_response.status_code == 200:
11047
print(advisor_response.json())
111-
comments = [
112-
get_comment(
113-
github_token,
114-
pr_number,
115-
generate_test_report_lib.generate_report(
116-
generate_test_report_lib.compute_platform_title(),
117-
return_code,
118-
junit_objects,
119-
ninja_logs,
120-
failure_explanations_list=advisor_response.json(),
121-
),
122-
)
123-
]
124-
with open("comment", "w") as comment_file_handle:
125-
json.dump(comments, comment_file_handle)
12648
else:
12749
print(advisor_response.reason)
12850

12951

13052
if __name__ == "__main__":
13153
parser = argparse.ArgumentParser()
13254
parser.add_argument("commit_sha", help="The base commit SHA for the test.")
133-
parser.add_argument("return_code", help="The build's return code", type=int)
134-
parser.add_argument("github_token", help="Github authentication token", type=str)
135-
parser.add_argument("pr_number", help="The PR number", type=int)
13655
parser.add_argument(
13756
"build_log_files", help="Paths to JUnit report files and ninja logs.", nargs="*"
13857
)
@@ -143,10 +62,4 @@ def main(
14362
if platform.machine() == "arm64":
14463
sys.exit(0)
14564

146-
main(
147-
args.commit_sha,
148-
args.build_log_files,
149-
args.github_token,
150-
args.pr_number,
151-
args.return_code,
152-
)
65+
main(args.commit_sha, args.build_log_files)

.ci/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
junitparser==3.2.0
22
google-cloud-storage==3.3.0
3-
PyGithub==2.8.1

.ci/utils.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,17 @@ function at-exit {
3333
# If building fails there will be no results files.
3434
shopt -s nullglob
3535

36-
if [[ "$GITHUB_ACTIONS" != "" ]]; then
36+
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
3737
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
3838
$retcode "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log \
3939
>> $GITHUB_STEP_SUMMARY
40-
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
41-
$(git rev-parse HEAD~1) $retcode "${GITHUB_TOKEN}" \
42-
$GITHUB_PR_NUMBER "${BUILD_DIR}"/test-results.*.xml \
43-
"${MONOREPO_ROOT}"/ninja*.log
4440
fi
4541

4642
if [[ "$retcode" != "0" ]]; then
4743
if [[ "$GITHUB_ACTIONS" != "" ]]; then
44+
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
45+
$(git rev-parse HEAD~1) "${BUILD_DIR}"/test-results.*.xml \
46+
"${MONOREPO_ROOT}"/ninja*.log
4847
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
4948
$(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \
5049
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log

.github/workflows/premerge.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ jobs:
6464
- name: Build and Test
6565
timeout-minutes: 120
6666
continue-on-error: ${{ runner.arch == 'ARM64' }}
67-
env:
68-
GITHUB_TOKEN: ${{ github.token }}
69-
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
7067
run: |
7168
git config --global --add safe.directory '*'
7269
@@ -156,9 +153,6 @@ jobs:
156153
timeout-minutes: 180
157154
if: ${{ steps.vars.outputs.windows-projects != '' }}
158155
shell: cmd
159-
env:
160-
GITHUB_TOKEN: ${{ github.token }}
161-
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
162156
run: |
163157
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
164158
# See the comments above in the Linux job for why we define each of

clang-tools-extra/clang-doc/assets/class-template.mustache

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,7 @@
141141
<div>
142142
{{#PublicMembers}}
143143
<div id="{{Name}}" class="delimiter-container">
144-
<pre>
145-
<code class="language-cpp code-clang-doc" >{{Type}} {{Name}}</code>
146-
</pre>
144+
<pre><code class="language-cpp code-clang-doc" >{{Type}} {{Name}}</code></pre>
147145
{{#MemberComments}}
148146
<div>
149147
{{>Comments}}
@@ -160,9 +158,7 @@
160158
<div>
161159
{{#Obj}}
162160
<div id="{{Name}}" class="delimiter-container">
163-
<pre>
164-
<code class="language-cpp code-clang-doc" >{{Type}} {{Name}}</code>
165-
</pre>
161+
<pre><code class="language-cpp code-clang-doc" >{{Type}} {{Name}}</code></pre>
166162
{{#MemberComments}}
167163
<div>
168164
{{>Comments}}

clang-tools-extra/clang-doc/assets/namespace-template.mustache

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@
9292
{{#Records}}
9393
<li id="{{USR}}" style="max-height: 40px;">
9494
<a href="{{DocumentationFileName}}.html">
95-
<pre>
96-
<code class="language-cpp code-clang-doc">class {{Name}}</code>
97-
</pre>
95+
<pre><code class="language-cpp code-clang-doc">class {{Name}}</code></pre>
9896
</a>
9997
</li>
10098
{{/Records}}

clang-tools-extra/test/clang-doc/mustache-index.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ class Foo;
7070
// CHECK-NEXT: <ul class="class-container">
7171
// CHECK-NEXT: <li id="{{[0-9A-F]*}}" style="max-height: 40px;">
7272
// CHECK-NEXT: <a href="_ZTV3Foo.html">
73-
// CHECK-NEXT: <pre>
74-
// CHECK-NEXT: <code class="language-cpp code-clang-doc">class Foo</code>
75-
// CHECK-NEXT: </pre>
73+
// CHECK-NEXT: <pre><code class="language-cpp code-clang-doc">class Foo</code></pre>
7674
// CHECK-NEXT: </a>
7775
// CHECK-NEXT: </li>
7876
// CHECK-NEXT: </ul>

clang-tools-extra/test/clang-doc/mustache-separate-namespace.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ namespace MyNamespace {
99
// CHECK: <ul class="class-container">
1010
// CHECK-NEXT: <li id="{{[0-9A-F]*}}" style="max-height: 40px;">
1111
// CHECK-NEXT: <a href="_ZTVN11MyNamespace3FooE.html">
12-
// CHECK-NEXT: <pre>
13-
// CHECK-NEXT: <code class="language-cpp code-clang-doc">class Foo</code>
14-
// CHECK-NEXT: </pre>
12+
// CHECK-NEXT: <pre><code class="language-cpp code-clang-doc">class Foo</code></pre>
1513
// CHECK-NEXT: </a>
1614
// CHECK-NEXT: </li>
1715
// CHECK-NEXT: </ul>

clang/include/clang/AST/OpenMPClause.h

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10068,6 +10068,152 @@ class OMPXDynCGroupMemClause
1006810068
Expr *getSize() const { return getStmtAs<Expr>(); }
1006910069
};
1007010070

10071+
/// This represents 'dyn_groupprivate' clause in '#pragma omp target ...'
10072+
/// and '#pragma omp teams ...' directives.
10073+
///
10074+
/// \code
10075+
/// #pragma omp target [...] dyn_groupprivate(a,b: N)
10076+
/// \endcode
10077+
class OMPDynGroupprivateClause : public OMPClause, public OMPClauseWithPreInit {
10078+
friend class OMPClauseReader;
10079+
10080+
/// Location of '('.
10081+
SourceLocation LParenLoc;
10082+
10083+
/// Modifiers for 'dyn_groupprivate' clause.
10084+
enum { SIMPLE, FALLBACK, NUM_MODIFIERS };
10085+
unsigned Modifiers[NUM_MODIFIERS];
10086+
10087+
/// Locations of modifiers.
10088+
SourceLocation ModifiersLoc[NUM_MODIFIERS];
10089+
10090+
/// The size of the dyn_groupprivate.
10091+
Expr *Size = nullptr;
10092+
10093+
/// Set the first dyn_groupprivate modifier.
10094+
///
10095+
/// \param M The modifier.
10096+
void setDynGroupprivateModifier(OpenMPDynGroupprivateClauseModifier M) {
10097+
Modifiers[SIMPLE] = M;
10098+
}
10099+
10100+
/// Set the second dyn_groupprivate modifier.
10101+
///
10102+
/// \param M The modifier.
10103+
void setDynGroupprivateFallbackModifier(
10104+
OpenMPDynGroupprivateClauseFallbackModifier M) {
10105+
Modifiers[FALLBACK] = M;
10106+
}
10107+
10108+
/// Set location of the first dyn_groupprivate modifier.
10109+
void setDynGroupprivateModifierLoc(SourceLocation Loc) {
10110+
ModifiersLoc[SIMPLE] = Loc;
10111+
}
10112+
10113+
/// Set location of the second dyn_groupprivate modifier.
10114+
void setDynGroupprivateFallbackModifierLoc(SourceLocation Loc) {
10115+
ModifiersLoc[FALLBACK] = Loc;
10116+
}
10117+
10118+
/// Sets the location of '('.
10119+
///
10120+
/// \param Loc Location of '('.
10121+
void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
10122+
10123+
/// Set size.
10124+
///
10125+
/// \param E Size.
10126+
void setSize(Expr *E) { Size = E; }
10127+
10128+
public:
10129+
/// Build 'dyn_groupprivate' clause with a size expression \a Size.
10130+
///
10131+
/// \param StartLoc Starting location of the clause.
10132+
/// \param LParenLoc Location of '('.
10133+
/// \param EndLoc Ending location of the clause.
10134+
/// \param Size Size.
10135+
/// \param M1 The first modifier applied to 'dyn_groupprivate' clause.
10136+
/// \param M1Loc Location of the first modifier.
10137+
/// \param M2 The second modifier applied to 'dyn_groupprivate' clause.
10138+
/// \param M2Loc Location of the second modifier.
10139+
OMPDynGroupprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
10140+
SourceLocation EndLoc, Expr *Size, Stmt *HelperSize,
10141+
OpenMPDirectiveKind CaptureRegion,
10142+
OpenMPDynGroupprivateClauseModifier M1,
10143+
SourceLocation M1Loc,
10144+
OpenMPDynGroupprivateClauseFallbackModifier M2,
10145+
SourceLocation M2Loc)
10146+
: OMPClause(llvm::omp::OMPC_dyn_groupprivate, StartLoc, EndLoc),
10147+
OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Size(Size) {
10148+
setPreInitStmt(HelperSize, CaptureRegion);
10149+
Modifiers[SIMPLE] = M1;
10150+
Modifiers[FALLBACK] = M2;
10151+
ModifiersLoc[SIMPLE] = M1Loc;
10152+
ModifiersLoc[FALLBACK] = M2Loc;
10153+
}
10154+
10155+
/// Build an empty clause.
10156+
explicit OMPDynGroupprivateClause()
10157+
: OMPClause(llvm::omp::OMPC_dyn_groupprivate, SourceLocation(),
10158+
SourceLocation()),
10159+
OMPClauseWithPreInit(this) {
10160+
Modifiers[SIMPLE] = OMPC_DYN_GROUPPRIVATE_unknown;
10161+
Modifiers[FALLBACK] = OMPC_DYN_GROUPPRIVATE_FALLBACK_unknown;
10162+
}
10163+
10164+
/// Get the first modifier of the clause.
10165+
OpenMPDynGroupprivateClauseModifier getDynGroupprivateModifier() const {
10166+
return static_cast<OpenMPDynGroupprivateClauseModifier>(Modifiers[SIMPLE]);
10167+
}
10168+
10169+
/// Get the second modifier of the clause.
10170+
OpenMPDynGroupprivateClauseFallbackModifier
10171+
getDynGroupprivateFallbackModifier() const {
10172+
return static_cast<OpenMPDynGroupprivateClauseFallbackModifier>(
10173+
Modifiers[FALLBACK]);
10174+
}
10175+
10176+
/// Get location of '('.
10177+
SourceLocation getLParenLoc() { return LParenLoc; }
10178+
10179+
/// Get the first modifier location.
10180+
SourceLocation getDynGroupprivateModifierLoc() const {
10181+
return ModifiersLoc[SIMPLE];
10182+
}
10183+
10184+
/// Get the second modifier location.
10185+
SourceLocation getDynGroupprivateFallbackModifierLoc() const {
10186+
return ModifiersLoc[FALLBACK];
10187+
}
10188+
10189+
/// Get size.
10190+
Expr *getSize() { return Size; }
10191+
10192+
/// Get size.
10193+
const Expr *getSize() const { return Size; }
10194+
10195+
child_range children() {
10196+
return child_range(reinterpret_cast<Stmt **>(&Size),
10197+
reinterpret_cast<Stmt **>(&Size) + 1);
10198+
}
10199+
10200+
const_child_range children() const {
10201+
auto Children = const_cast<OMPDynGroupprivateClause *>(this)->children();
10202+
return const_child_range(Children.begin(), Children.end());
10203+
}
10204+
10205+
child_range used_children() {
10206+
return child_range(child_iterator(), child_iterator());
10207+
}
10208+
const_child_range used_children() const {
10209+
return const_child_range(const_child_iterator(), const_child_iterator());
10210+
}
10211+
10212+
static bool classof(const OMPClause *T) {
10213+
return T->getClauseKind() == llvm::omp::OMPC_dyn_groupprivate;
10214+
}
10215+
};
10216+
1007110217
/// This represents the 'doacross' clause for the '#pragma omp ordered'
1007210218
/// directive.
1007310219
///

0 commit comments

Comments
 (0)