Skip to content

Commit d168cf3

Browse files
committed
merge main into amd-staging
2 parents c70b8c1 + 46236f4 commit d168cf3

File tree

355 files changed

+11204
-3296
lines changed

Some content is hidden

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

355 files changed

+11204
-3296
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
fetch-depth: 1
6666
- name: Get subprojects that have doc changes
6767
id: docs-changed-subprojects
68-
uses: tj-actions/changed-files@fea790cb660e33aef4bdf07304e28fedd77dfa13 # v39.2.4
68+
uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45.0.7
6969
with:
7070
files_yaml: |
7171
llvm:

.github/workflows/issue-write.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
- name: 'Comment on PR'
4141
if: steps.download-artifact.outputs.artifact-id != ''
42-
uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736 # v3.2.0
42+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
4343
with:
4444
github-token: ${{ secrets.GITHUB_TOKEN }}
4545
script: |

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ Fixed Point Support in Clang
361361
AST Matchers
362362
------------
363363

364+
- Ensure ``isDerivedFrom`` matches the correct base in case more than one alias exists.
365+
364366
clang-format
365367
------------
366368

clang/include/clang/AST/Type.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2661,6 +2661,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
26612661
bool isHLSLSpecificType() const; // Any HLSL specific type
26622662
bool isHLSLBuiltinIntangibleType() const; // Any HLSL builtin intangible type
26632663
bool isHLSLAttributedResourceType() const;
2664+
bool isHLSLResourceRecord() const;
26642665
bool isHLSLIntangibleType()
26652666
const; // Any HLSL intangible type (builtin, array, class)
26662667

clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ enum class ScanningOptimizations {
6767
IgnoreCWD = (1 << 4),
6868

6969
DSS_LAST_BITMASK_ENUM(IgnoreCWD),
70-
Default = All
70+
71+
// The build system needs to be aware that the current working
72+
// directory is ignored. Without a good way of notifying the build
73+
// system, it is less risky to default to off.
74+
Default = All & (~IgnoreCWD)
7175
};
7276

7377
#undef DSS_LAST_BITMASK_ENUM

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,9 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
714714
return false;
715715
}
716716

717+
if (S.checkingPotentialConstantExpression() && S.Current->getDepth() != 0)
718+
return false;
719+
717720
if (F->isConstexpr() && F->hasBody() &&
718721
(F->getDecl()->isConstexpr() || F->getDecl()->hasAttr<MSConstexprAttr>()))
719722
return true;

clang/lib/AST/Type.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5114,6 +5114,10 @@ bool Type::hasSizedVLAType() const {
51145114
return false;
51155115
}
51165116

5117+
bool Type::isHLSLResourceRecord() const {
5118+
return HLSLAttributedResourceType::findHandleTypeOnResource(this) != nullptr;
5119+
}
5120+
51175121
bool Type::isHLSLIntangibleType() const {
51185122
const Type *Ty = getUnqualifiedDesugaredType();
51195123

clang/lib/ASTMatchers/ASTMatchFinder.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,27 @@ class MatchASTVisitor : public RecursiveASTVisitor<MatchASTVisitor>,
12871287
auto Aliases = TypeAliases.find(CanonicalType);
12881288
if (Aliases == TypeAliases.end())
12891289
return false;
1290+
1291+
if (const auto *ElaboratedTypeNode =
1292+
llvm::dyn_cast<ElaboratedType>(TypeNode)) {
1293+
if (ElaboratedTypeNode->isSugared() && Aliases->second.size() > 1) {
1294+
const auto &DesugaredTypeName =
1295+
ElaboratedTypeNode->desugar().getAsString();
1296+
1297+
for (const TypedefNameDecl *Alias : Aliases->second) {
1298+
if (Alias->getName() != DesugaredTypeName) {
1299+
continue;
1300+
}
1301+
1302+
BoundNodesTreeBuilder Result(*Builder);
1303+
if (Matcher.matches(*Alias, this, &Result)) {
1304+
*Builder = std::move(Result);
1305+
return true;
1306+
}
1307+
}
1308+
}
1309+
}
1310+
12901311
for (const TypedefNameDecl *Alias : Aliases->second) {
12911312
BoundNodesTreeBuilder Result(*Builder);
12921313
if (Matcher.matches(*Alias, this, &Result)) {

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,11 @@ llvm::Triple::ArchType CGHLSLRuntime::getArch() {
8585
return CGM.getTarget().getTriple().getArch();
8686
}
8787

88-
// Returns true if the type is an HLSL resource class
89-
static bool isResourceRecordType(const clang::Type *Ty) {
90-
return HLSLAttributedResourceType::findHandleTypeOnResource(Ty) != nullptr;
91-
}
92-
9388
// Returns true if the type is an HLSL resource class or an array of them
9489
static bool isResourceRecordTypeOrArrayOf(const clang::Type *Ty) {
9590
while (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(Ty))
9691
Ty = CAT->getArrayElementTypeNoTypeQual();
97-
return isResourceRecordType(Ty);
92+
return Ty->isHLSLResourceRecord();
9893
}
9994

10095
// Emits constant global variables for buffer constants declarations
@@ -658,7 +653,7 @@ void CGHLSLRuntime::handleGlobalVarDefinition(const VarDecl *VD,
658653
// on?
659654
return;
660655

661-
if (!isResourceRecordType(VD->getType().getTypePtr()))
656+
if (!VD->getType().getTypePtr()->isHLSLResourceRecord())
662657
// FIXME: Only simple declarations of resources are supported for now.
663658
// Arrays of resources or resources in user defined classes are
664659
// not implemented yet.

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5608,7 +5608,11 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D,
56085608
if (D->getType()->isReferenceType())
56095609
T = D->getType();
56105610

5611-
if (getLangOpts().CPlusPlus) {
5611+
if (getLangOpts().HLSL &&
5612+
D->getType().getTypePtr()->isHLSLResourceRecord()) {
5613+
Init = llvm::PoisonValue::get(getTypes().ConvertType(ASTTy));
5614+
NeedsGlobalCtor = true;
5615+
} else if (getLangOpts().CPlusPlus) {
56125616
Init = EmitNullConstant(T);
56135617
if (!IsDefinitionAvailableExternally)
56145618
NeedsGlobalCtor = true;

0 commit comments

Comments
 (0)