Skip to content

Commit d7cdd82

Browse files
authored
merge main into amd-staging (llvm#4141)
2 parents ebffd31 + 903483b commit d7cdd82

23 files changed

+1272
-763
lines changed

.github/workflows/pr-code-format.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,6 @@ jobs:
3232
base_sha: 'HEAD~1'
3333
sha: 'HEAD'
3434

35-
# We need to pull the script from the main branch, so that we ensure
36-
# we get the latest version of this script.
37-
- name: Fetch code formatting utils
38-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
39-
with:
40-
repository: ${{ github.repository }}
41-
ref: ${{ github.base_ref }}
42-
sparse-checkout: |
43-
llvm/utils/git/requirements_formatting.txt
44-
llvm/utils/git/code-format-helper.py
45-
sparse-checkout-cone-mode: false
46-
path: code-format-tools
47-
4835
- name: "Listed files"
4936
env:
5037
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
@@ -65,10 +52,10 @@ jobs:
6552
with:
6653
python-version: '3.11'
6754
cache: 'pip'
68-
cache-dependency-path: 'code-format-tools/llvm/utils/git/requirements_formatting.txt'
55+
cache-dependency-path: 'llvm/utils/git/requirements_formatting.txt'
6956

7057
- name: Install python dependencies
71-
run: pip install -r code-format-tools/llvm/utils/git/requirements_formatting.txt
58+
run: pip install -r llvm/utils/git/requirements_formatting.txt
7259

7360
- name: Run code formatter
7461
env:
@@ -77,7 +64,7 @@ jobs:
7764
# Create an empty comments file so the pr-write job doesn't fail.
7865
run: |
7966
echo "[]" > comments &&
80-
python ./code-format-tools/llvm/utils/git/code-format-helper.py \
67+
python ./llvm/utils/git/code-format-helper.py \
8168
--write-comment-to-file \
8269
--token ${{ secrets.GITHUB_TOKEN }} \
8370
--issue-number $GITHUB_PR_NUMBER \

.github/workflows/pr-code-lint.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,6 @@ jobs:
4646
run: |
4747
echo "Changed files:"
4848
echo "$CHANGED_FILES"
49-
50-
- name: Fetch code linting utils
51-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
52-
with:
53-
repository: ${{ github.repository }}
54-
ref: ${{ github.base_ref }}
55-
sparse-checkout: |
56-
llvm/utils/git/code-lint-helper.py
57-
llvm/utils/git/requirements_linting.txt
58-
clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
59-
sparse-checkout-cone-mode: false
60-
path: code-lint-tools
6149
6250
- name: Install clang-tidy
6351
uses: aminya/setup-cpp@17c11551771948abc5752bbf3183482567c7caf0 # v1.1.1
@@ -70,7 +58,7 @@ jobs:
7058
python-version: '3.12'
7159

7260
- name: Install Python dependencies
73-
run: python3 -m pip install -r code-lint-tools/llvm/utils/git/requirements_linting.txt
61+
run: python3 -m pip install -r llvm/utils/git/requirements_linting.txt
7462

7563
# TODO: create special mapping for 'codegen' targets, for now build predefined set
7664
# TODO: add entrypoint in 'compute_projects.py' that only adds a project and its direct dependencies
@@ -107,7 +95,7 @@ jobs:
10795
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
10896
run: |
10997
echo "[]" > comments &&
110-
python3 ./code-lint-tools/llvm/utils/git/code-lint-helper.py \
98+
python3 llvm/utils/git/code-lint-helper.py \
11199
--token ${{ secrets.GITHUB_TOKEN }} \
112100
--issue-number $GITHUB_PR_NUMBER \
113101
--start-rev HEAD~1 \

clang/lib/AST/JSONNodeDumper.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,9 @@ void JSONNodeDumper::VisitVarDecl(const VarDecl *VD) {
944944
}
945945
}
946946
attributeOnlyIfTrue("isParameterPack", VD->isParameterPack());
947+
if (const auto *Instance = VD->getTemplateInstantiationPattern())
948+
JOS.attribute("TemplateInstantiationPattern",
949+
createPointerRepresentation(Instance));
947950
}
948951

949952
void JSONNodeDumper::VisitFieldDecl(const FieldDecl *FD) {
@@ -975,6 +978,10 @@ void JSONNodeDumper::VisitFunctionDecl(const FunctionDecl *FD) {
975978

976979
if (StringLiteral *Msg = FD->getDeletedMessage())
977980
JOS.attribute("deletedMessage", Msg->getString());
981+
982+
if (const auto *Instance = FD->getTemplateInstantiationPattern())
983+
JOS.attribute("TemplateInstantiationPattern",
984+
createPointerRepresentation(Instance));
978985
}
979986

980987
void JSONNodeDumper::VisitEnumDecl(const EnumDecl *ED) {
@@ -984,6 +991,9 @@ void JSONNodeDumper::VisitEnumDecl(const EnumDecl *ED) {
984991
if (ED->isScoped())
985992
JOS.attribute("scopedEnumTag",
986993
ED->isScopedUsingClassTag() ? "class" : "struct");
994+
if (const auto *Instance = ED->getTemplateInstantiationPattern())
995+
JOS.attribute("TemplateInstantiationPattern",
996+
createPointerRepresentation(Instance));
987997
}
988998
void JSONNodeDumper::VisitEnumConstantDecl(const EnumConstantDecl *ECD) {
989999
VisitNamedDecl(ECD);
@@ -1003,6 +1013,10 @@ void JSONNodeDumper::VisitCXXRecordDecl(const CXXRecordDecl *RD) {
10031013
JOS.attribute("strict-pack-match", true);
10041014
}
10051015

1016+
if (const auto *Instance = RD->getTemplateInstantiationPattern())
1017+
JOS.attribute("TemplateInstantiationPattern",
1018+
createPointerRepresentation(Instance));
1019+
10061020
// All other information requires a complete definition.
10071021
if (!RD->isCompleteDefinition())
10081022
return;

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,7 +2273,7 @@ void TextNodeDumper::VisitEnumDecl(const EnumDecl *D) {
22732273
if (D->isFixed())
22742274
dumpType(D->getIntegerType());
22752275

2276-
if (const auto *Instance = D->getInstantiatedFromMemberEnum()) {
2276+
if (const auto *Instance = D->getTemplateInstantiationPattern()) {
22772277
OS << " instantiated_from";
22782278
dumpPointer(Instance);
22792279
}
@@ -2379,7 +2379,7 @@ void TextNodeDumper::VisitFunctionDecl(const FunctionDecl *D) {
23792379
if (!D->param_empty() && !D->param_begin())
23802380
OS << " <<<NULL params x " << D->getNumParams() << ">>>";
23812381

2382-
if (const auto *Instance = D->getInstantiatedFromMemberFunction()) {
2382+
if (const auto *Instance = D->getTemplateInstantiationPattern()) {
23832383
OS << " instantiated_from";
23842384
dumpPointer(Instance);
23852385
}
@@ -2468,6 +2468,11 @@ void TextNodeDumper::VisitVarDecl(const VarDecl *D) {
24682468
if (D->isParameterPack())
24692469
OS << " pack";
24702470

2471+
if (const auto *Instance = D->getTemplateInstantiationPattern()) {
2472+
OS << " instantiated_from";
2473+
dumpPointer(Instance);
2474+
}
2475+
24712476
if (D->hasInit()) {
24722477
const Expr *E = D->getInit();
24732478
// Only dump the value of constexpr VarDecls for now.
@@ -2615,7 +2620,7 @@ void TextNodeDumper::VisitTypeAliasTemplateDecl(
26152620

26162621
void TextNodeDumper::VisitCXXRecordDecl(const CXXRecordDecl *D) {
26172622
VisitRecordDecl(D);
2618-
if (const auto *Instance = D->getInstantiatedFromMemberClass()) {
2623+
if (const auto *Instance = D->getTemplateInstantiationPattern()) {
26192624
OS << " instantiated_from";
26202625
dumpPointer(Instance);
26212626
}

clang/lib/Sema/SemaCXXScopeSpec.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,11 @@ bool Sema::RequireCompleteDeclContext(CXXScopeSpec &SS,
220220
///
221221
bool Sema::RequireCompleteEnumDecl(EnumDecl *EnumD, SourceLocation L,
222222
CXXScopeSpec *SS) {
223-
if (EnumD->isCompleteDefinition()) {
223+
if (EnumDecl *Def = EnumD->getDefinition();
224+
Def && Def->isCompleteDefinition()) {
224225
// If we know about the definition but it is not visible, complain.
225226
NamedDecl *SuggestedDef = nullptr;
226-
if (!hasReachableDefinition(EnumD, &SuggestedDef,
227+
if (!hasReachableDefinition(Def, &SuggestedDef,
227228
/*OnlyNeedComplete*/ false)) {
228229
// If the user is going to see an error here, recover by making the
229230
// definition visible.

0 commit comments

Comments
 (0)