@@ -71,22 +71,23 @@ struct TemplateParameterListBuilder {
7171// BuiltinTypeMethodBuilder(RecordBuilder, "MethodName", ReturnType)
7272// .addParam("param_name", Type, InOutModifier)
7373// .callBuiltin("builtin_name", BuiltinParams...)
74- // .finalizeMethod ();
74+ // .finalize ();
7575//
7676// The builder needs to have all of the method parameters before it can create
7777// a CXXMethodDecl. It collects them in addParam calls and when a first
7878// method that builds the body is called or when access to 'this` is needed it
7979// creates the CXXMethodDecl and ParmVarDecls instances. These can then be
8080// referenced from the body building methods. Destructor or an explicit call to
81- // finalizeMethod () will complete the method definition.
81+ // finalize () will complete the method definition.
8282//
8383// The callBuiltin helper method accepts constants via `Expr *` or placeholder
8484// value arguments to indicate which function arguments to forward to the
8585// builtin.
8686//
8787// If the method that is being built has a non-void return type the
88- // finalizeMethod will create a return statent with the value of the last
89- // statement (unless the last statement is already a ReturnStmt).
88+ // finalize() will create a return statement with the value of the last
89+ // statement (unless the last statement is already a ReturnStmt or the return
90+ // value is void).
9091struct BuiltinTypeMethodBuilder {
9192private:
9293 struct Param {
@@ -135,7 +136,7 @@ struct BuiltinTypeMethodBuilder {
135136 bool IsConstructor = false );
136137 BuiltinTypeMethodBuilder (const BuiltinTypeMethodBuilder &Other) = delete;
137138
138- ~BuiltinTypeMethodBuilder () { finalizeMethod (); }
139+ ~BuiltinTypeMethodBuilder () { finalize (); }
139140
140141 BuiltinTypeMethodBuilder &
141142 operator =(const BuiltinTypeMethodBuilder &Other) = delete ;
@@ -149,7 +150,7 @@ struct BuiltinTypeMethodBuilder {
149150 template <typename TLHS, typename TRHS>
150151 BuiltinTypeMethodBuilder &assign (TLHS LHS, TRHS RHS);
151152 template <typename T> BuiltinTypeMethodBuilder &dereference (T Ptr);
152- BuiltinTypeDeclBuilder &finalizeMethod ();
153+ BuiltinTypeDeclBuilder &finalize ();
153154 Expr *getResourceHandleExpr ();
154155
155156private:
@@ -478,7 +479,7 @@ BuiltinTypeMethodBuilder &BuiltinTypeMethodBuilder::dereference(T Ptr) {
478479 return *this ;
479480}
480481
481- BuiltinTypeDeclBuilder &BuiltinTypeMethodBuilder::finalizeMethod () {
482+ BuiltinTypeDeclBuilder &BuiltinTypeMethodBuilder::finalize () {
482483 assert (!DeclBuilder.Record ->isCompleteDefinition () &&
483484 " record is already complete" );
484485
@@ -638,7 +639,7 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addDefaultHandleConstructor() {
638639 // value will get overwritten.
639640 return BuiltinTypeMethodBuilder (*this , " " , SemaRef.getASTContext ().VoidTy ,
640641 false , true )
641- .finalizeMethod ();
642+ .finalize ();
642643}
643644
644645BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addArraySubscriptOperators () {
@@ -732,7 +733,7 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addIncrementCounterMethod() {
732733 SemaRef.getASTContext ().UnsignedIntTy )
733734 .callBuiltin (" __builtin_hlsl_buffer_update_counter" , QualType (),
734735 PH::Handle, getConstantIntExpr (1 ))
735- .finalizeMethod ();
736+ .finalize ();
736737}
737738
738739BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addDecrementCounterMethod () {
@@ -741,7 +742,7 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addDecrementCounterMethod() {
741742 SemaRef.getASTContext ().UnsignedIntTy )
742743 .callBuiltin (" __builtin_hlsl_buffer_update_counter" , QualType (),
743744 PH::Handle, getConstantIntExpr (-1 ))
744- .finalizeMethod ();
745+ .finalize ();
745746}
746747
747748BuiltinTypeDeclBuilder &
@@ -765,7 +766,7 @@ BuiltinTypeDeclBuilder::addHandleAccessFunction(DeclarationName &Name,
765766 .callBuiltin (" __builtin_hlsl_resource_getpointer" , ElemPtrTy, PH::Handle,
766767 PH::_0)
767768 .dereference (PH::LastStmt)
768- .finalizeMethod ();
769+ .finalize ();
769770}
770771
771772BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addAppendMethod () {
@@ -780,7 +781,7 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addAppendMethod() {
780781 AST.getPointerType (ElemTy), PH::Handle, PH::LastStmt)
781782 .dereference (PH::LastStmt)
782783 .assign (PH::LastStmt, PH::_0)
783- .finalizeMethod ();
784+ .finalize ();
784785}
785786
786787BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addConsumeMethod () {
@@ -793,7 +794,7 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addConsumeMethod() {
793794 .callBuiltin (" __builtin_hlsl_resource_getpointer" ,
794795 AST.getPointerType (ElemTy), PH::Handle, PH::LastStmt)
795796 .dereference (PH::LastStmt)
796- .finalizeMethod ();
797+ .finalize ();
797798}
798799
799800} // namespace hlsl
0 commit comments