Skip to content

Commit a90b3a1

Browse files
committed
code review feedback - update comment, add new line
1 parent 43aedd4 commit a90b3a1

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

clang/include/clang/AST/Decl.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5087,8 +5087,16 @@ class HLSLBufferDecl final : public NamedDecl, public DeclContext {
50875087
return static_cast<HLSLBufferDecl *>(const_cast<DeclContext *>(DC));
50885088
}
50895089

5090-
// Iterator for the buffer decls. Concatenates the list of decls parented
5091-
// by this HLSLBufferDecl with the list of default buffer decls.
5090+
// Iterator for the buffer decls. For constant buffers explicitly declared
5091+
// with `cbuffer` keyword this will the list of decls parented by this
5092+
// HLSLBufferDecl (equal to `decls()`).
5093+
// For implicit $Globals buffer this will be the list of default buffer
5094+
// declarations stored in DefaultBufferDecls plus the implicit layout
5095+
// struct (the only child of HLSLBufferDecl in this case).
5096+
//
5097+
// The iterator uses llvm::concat_iterator to concatenate the lists
5098+
// `decls()` and `DefaultBufferDecls`. For non-default buffers
5099+
// `DefaultBufferDecls` is always empty.
50925100
using buffer_decl_iterator =
50935101
llvm::concat_iterator<Decl *const, SmallVector<Decl *>::const_iterator,
50945102
decl_iterator>;

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ void CGHLSLRuntime::emitBufferGlobalsAndMetadata(const HLSLBufferDecl *BufDecl,
150150
llvm::Type *LayoutType = *ElemIt++;
151151

152152
// FIXME: handle resources in cbuffer user-defined structs
153+
// Issue llvm/wg-hlsl#175
153154

154155
// create global variable for the constant and to metadata list
155156
GlobalVariable *ElemGV =

clang/test/CodeGenHLSL/default_cbuffer.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ void main() {
3636
}
3737

3838
// CHECK: !hlsl.cbs = !{![[CB:.*]]}
39-
// CHECK: ![[CB]] = !{ptr @"$Globals.cb", ptr addrspace(2) @a, ptr addrspace(2) @g, ptr addrspace(2) @h}
39+
// CHECK: ![[CB]] = !{ptr @"$Globals.cb", ptr addrspace(2) @a, ptr addrspace(2) @g, ptr addrspace(2) @h}

0 commit comments

Comments
 (0)