Skip to content

Commit 238c120

Browse files
author
git apple-llvm automerger
committed
Merge commit '19af8581d51b' from llvm.org/main into next
2 parents 56a74fa + 19af858 commit 238c120

20 files changed

+871
-239
lines changed

clang/include/clang/AST/Decl.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5050,6 +5050,11 @@ class HLSLBufferDecl final : public NamedDecl, public DeclContext {
50505050
SourceLocation KwLoc;
50515051
/// IsCBuffer - Whether the buffer is a cbuffer (and not a tbuffer).
50525052
bool IsCBuffer;
5053+
/// HasValidPackoffset - Whether the buffer has valid packoffset annotations
5054+
// on all declarations
5055+
bool HasValidPackoffset;
5056+
// LayoutStruct - Layout struct for the buffer
5057+
CXXRecordDecl *LayoutStruct;
50535058

50545059
HLSLBufferDecl(DeclContext *DC, bool CBuffer, SourceLocation KwLoc,
50555060
IdentifierInfo *ID, SourceLocation IDLoc,
@@ -5070,6 +5075,10 @@ class HLSLBufferDecl final : public NamedDecl, public DeclContext {
50705075
SourceLocation getRBraceLoc() const { return RBraceLoc; }
50715076
void setRBraceLoc(SourceLocation L) { RBraceLoc = L; }
50725077
bool isCBuffer() const { return IsCBuffer; }
5078+
void setHasValidPackoffset(bool PO) { HasValidPackoffset = PO; }
5079+
bool hasValidPackoffset() const { return HasValidPackoffset; }
5080+
const CXXRecordDecl *getLayoutStruct() const { return LayoutStruct; }
5081+
void addLayoutStruct(CXXRecordDecl *LS);
50735082

50745083
// Implement isa/cast/dyncast/etc.
50755084
static bool classof(const Decl *D) { return classofKind(D->getKind()); }

clang/include/clang/AST/Type.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6723,8 +6723,8 @@ class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode {
67236723
LLVM_PREFERRED_TYPE(bool)
67246724
uint8_t RawBuffer : 1;
67256725

6726-
Attributes(llvm::dxil::ResourceClass ResourceClass, bool IsROV,
6727-
bool RawBuffer)
6726+
Attributes(llvm::dxil::ResourceClass ResourceClass, bool IsROV = false,
6727+
bool RawBuffer = false)
67286728
: ResourceClass(ResourceClass), IsROV(IsROV), RawBuffer(RawBuffer) {}
67296729

67306730
Attributes() : Attributes(llvm::dxil::ResourceClass::UAV, false, false) {}

clang/lib/AST/Decl.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1764,6 +1764,10 @@ void NamedDecl::printNestedNameSpecifier(raw_ostream &OS,
17641764
}
17651765
}
17661766

1767+
// Suppress transparent contexts like export or HLSLBufferDecl context
1768+
if (Ctx->isTransparentContext())
1769+
continue;
1770+
17671771
// Skip non-named contexts such as linkage specifications and ExportDecls.
17681772
const NamedDecl *ND = dyn_cast<NamedDecl>(Ctx);
17691773
if (!ND)
@@ -5779,7 +5783,7 @@ HLSLBufferDecl::HLSLBufferDecl(DeclContext *DC, bool CBuffer,
57795783
SourceLocation IDLoc, SourceLocation LBrace)
57805784
: NamedDecl(Decl::Kind::HLSLBuffer, DC, IDLoc, DeclarationName(ID)),
57815785
DeclContext(Decl::Kind::HLSLBuffer), LBraceLoc(LBrace), KwLoc(KwLoc),
5782-
IsCBuffer(CBuffer) {}
5786+
IsCBuffer(CBuffer), HasValidPackoffset(false), LayoutStruct(nullptr) {}
57835787

57845788
HLSLBufferDecl *HLSLBufferDecl::Create(ASTContext &C,
57855789
DeclContext *LexicalParent, bool CBuffer,
@@ -5809,6 +5813,12 @@ HLSLBufferDecl *HLSLBufferDecl::CreateDeserialized(ASTContext &C,
58095813
SourceLocation(), SourceLocation());
58105814
}
58115815

5816+
void HLSLBufferDecl::addLayoutStruct(CXXRecordDecl *LS) {
5817+
assert(LayoutStruct == nullptr && "layout struct has already been set");
5818+
LayoutStruct = LS;
5819+
addDecl(LS);
5820+
}
5821+
58125822
//===----------------------------------------------------------------------===//
58135823
// ImportDecl Implementation
58145824
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)