Skip to content

Commit 039f49d

Browse files
committed
clang format
1 parent 611ef1f commit 039f49d

File tree

3 files changed

+35
-29
lines changed

3 files changed

+35
-29
lines changed

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ void addRootSignature(
126126

127127
llvm::hlsl::root_signature::MetadataBuilder Builder(Ctx, Elements);
128128
MDNode *RootSignature = Builder.BuildRootSignature();
129-
MDNode *FnPairing = MDNode::get(Ctx, {ValueAsMetadata::get(Fn),
130-
RootSignature});
129+
MDNode *FnPairing =
130+
MDNode::get(Ctx, {ValueAsMetadata::get(Fn), RootSignature});
131131

132132
StringRef RootSignatureValKey = "dx.rootsignatures";
133133
auto *RootSignatureValMD = M.getOrInsertNamedMetadata(RootSignatureValKey);

llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,17 @@ using ParamType = std::variant<uint32_t *, DescriptorRangeOffset *,
129129
DescriptorRangeFlags *, ShaderVisibility *>;
130130

131131
class MetadataBuilder {
132-
public:
132+
public:
133133
MetadataBuilder(llvm::LLVMContext &Ctx, ArrayRef<RootElement> Elements)
134-
: Ctx(Ctx), Elements(Elements) {}
134+
: Ctx(Ctx), Elements(Elements) {}
135135

136136
// Iterates through the elements and dispatches onto the correct Build method
137137
//
138138
// Accumulates the root signature and returns the Metadata node that is just
139139
// a list of all the elements
140140
MDNode *BuildRootSignature();
141141

142-
private:
142+
private:
143143
// Define the various builders for the different metadata types
144144
MDNode *BuildDescriptorTable(const DescriptorTable &Table);
145145
MDNode *BuildDescriptorTableClause(const DescriptorTableClause &Clause);

llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//===- HLSLRootSignature.cpp - HLSL Root Signature helper objects ----------===//
1+
//===- HLSLRootSignature.cpp - HLSL Root Signature helper objects
2+
//----------===//
23
//
34
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45
// See https://llvm.org/LICENSE.txt for license information.
@@ -49,16 +50,15 @@ template <class... Ts> OverloadBuilds(Ts...) -> OverloadBuilds<Ts...>;
4950
MDNode *MetadataBuilder::BuildRootSignature() {
5051
for (const RootElement &Element : Elements) {
5152
MDNode *ElementMD =
52-
std::visit(
53-
OverloadBuilds{
54-
[&](DescriptorTable Table) -> MDNode * {
55-
return BuildDescriptorTable(Table);
56-
},
57-
[&](DescriptorTableClause Clause) -> MDNode * {
58-
return BuildDescriptorTableClause(Clause);
59-
},
60-
},
61-
Element);
53+
std::visit(OverloadBuilds{
54+
[&](DescriptorTable Table) -> MDNode * {
55+
return BuildDescriptorTable(Table);
56+
},
57+
[&](DescriptorTableClause Clause) -> MDNode * {
58+
return BuildDescriptorTableClause(Clause);
59+
},
60+
},
61+
Element);
6262
GeneratedMetadata.push_back(ElementMD);
6363
}
6464

@@ -70,33 +70,39 @@ MDNode *MetadataBuilder::BuildDescriptorTable(const DescriptorTable &Table) {
7070
SmallVector<Metadata *> TableOperands;
7171
// Set the mandatory arguments
7272
TableOperands.push_back(MDString::get(Ctx, "DescriptorTable"));
73-
TableOperands.push_back(ConstantAsMetadata::get(B.getInt32(llvm::to_underlying(Table.Visibility))));
73+
TableOperands.push_back(ConstantAsMetadata::get(
74+
B.getInt32(llvm::to_underlying(Table.Visibility))));
7475

7576
// Remaining operands are references to the table's clauses. The in-memory
7677
// representation of the Root Elements created from parsing will ensure that
7778
// the previous N elements are the clauses for this table.
78-
assert(Table.NumClauses <= GeneratedMetadata.size() && "Table expected all owned clauses to be generated already");
79+
assert(Table.NumClauses <= GeneratedMetadata.size() &&
80+
"Table expected all owned clauses to be generated already");
7981
// So, add a refence to each clause to our operands
80-
TableOperands.append(GeneratedMetadata.end() - Table.NumClauses, GeneratedMetadata.end());
82+
TableOperands.append(GeneratedMetadata.end() - Table.NumClauses,
83+
GeneratedMetadata.end());
8184
// Then, remove those clauses from the general list of Root Elements
8285
GeneratedMetadata.pop_back_n(Table.NumClauses);
8386

8487
return MDNode::get(Ctx, TableOperands);
8588
}
8689

87-
MDNode *MetadataBuilder::BuildDescriptorTableClause(const DescriptorTableClause &Clause) {
90+
MDNode *MetadataBuilder::BuildDescriptorTableClause(
91+
const DescriptorTableClause &Clause) {
8892
IRBuilder<> B(Ctx);
89-
return MDNode::get(Ctx, {
90-
ClauseTypeToName(Ctx, Clause.Type),
91-
ConstantAsMetadata::get(B.getInt32(Clause.NumDescriptors)),
92-
ConstantAsMetadata::get(B.getInt32(Clause.Register.Number)),
93-
ConstantAsMetadata::get(B.getInt32(Clause.Space)),
94-
ConstantAsMetadata::get(B.getInt32(llvm::to_underlying(Clause.Offset))),
95-
ConstantAsMetadata::get(B.getInt32(llvm::to_underlying(Clause.Flags))),
96-
});
93+
return MDNode::get(
94+
Ctx, {
95+
ClauseTypeToName(Ctx, Clause.Type),
96+
ConstantAsMetadata::get(B.getInt32(Clause.NumDescriptors)),
97+
ConstantAsMetadata::get(B.getInt32(Clause.Register.Number)),
98+
ConstantAsMetadata::get(B.getInt32(Clause.Space)),
99+
ConstantAsMetadata::get(
100+
B.getInt32(llvm::to_underlying(Clause.Offset))),
101+
ConstantAsMetadata::get(
102+
B.getInt32(llvm::to_underlying(Clause.Flags))),
103+
});
97104
}
98105

99106
} // namespace root_signature
100107
} // namespace hlsl
101108
} // namespace llvm
102-

0 commit comments

Comments
 (0)