[all-commits] [llvm/llvm-project] 89fb84: [HLSL] Implement output parameter (#101083)

Chris B via All-commits all-commits at lists.llvm.org
Sat Aug 31 08:59:29 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 89fb8490a99e612f7a574e8678b21a90f689f5b4
      https://github.com/llvm/llvm-project/commit/89fb8490a99e612f7a574e8678b21a90f689f5b4
  Author: Chris B <chris.bieneman at me.com>
  Date:   2024-08-31 (Sat, 31 Aug 2024)

  Changed paths:
    M clang/include/clang/AST/ASTContext.h
    M clang/include/clang/AST/Attr.h
    M clang/include/clang/AST/Expr.h
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/include/clang/AST/TextNodeDumper.h
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Basic/Specifiers.h
    M clang/include/clang/Basic/StmtNodes.td
    M clang/include/clang/Sema/SemaHLSL.h
    M clang/include/clang/Serialization/ASTBitCodes.h
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/Expr.cpp
    M clang/lib/AST/ExprClassification.cpp
    M clang/lib/AST/ExprConstant.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/StmtPrinter.cpp
    M clang/lib/AST/StmtProfile.cpp
    M clang/lib/AST/TextNodeDumper.cpp
    M clang/lib/AST/TypePrinter.cpp
    M clang/lib/CodeGen/CGCall.cpp
    M clang/lib/CodeGen/CGCall.h
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CGExprAgg.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    M clang/lib/Sema/SemaChecking.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaExceptionSpec.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaHLSL.cpp
    M clang/lib/Sema/SemaOverload.cpp
    M clang/lib/Sema/SemaSwift.cpp
    M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
    M clang/lib/Sema/SemaType.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/lib/Serialization/ASTReaderStmt.cpp
    M clang/lib/Serialization/ASTWriterStmt.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
    A clang/test/AST/HLSL/OutArgExpr.hlsl
    A clang/test/CodeGenHLSL/BasicFeatures/OutputArguments.hlsl
    A clang/test/SemaHLSL/Language/OutputParameters.hlsl
    A clang/test/SemaHLSL/Language/TemplateOutArg.hlsl
    M clang/test/SemaHLSL/parameter_modifiers.hlsl
    M clang/test/SemaHLSL/parameter_modifiers_ast.hlsl
    M clang/tools/libclang/CXCursor.cpp

  Log Message:
  -----------
  [HLSL] Implement output parameter (#101083)

HLSL output parameters are denoted with the `inout` and `out` keywords
in the function declaration. When an argument to an output parameter is
constructed a temporary value is constructed for the argument.

For `inout` pamameters the argument is initialized via copy-initialization
from the argument lvalue expression to the parameter type. For `out`
parameters the argument is not initialized before the call.

In both cases on return of the function the temporary value is written
back to the argument lvalue expression through an implicit assignment
binary operator with casting as required.

This change introduces a new HLSLOutArgExpr ast node which represents
the output argument behavior. The OutArgExpr has three defined children:
- An OpaqueValueExpr of the argument lvalue expression.
- An OpaqueValueExpr of the copy-initialized parameter.
- A BinaryOpExpr assigning the first with the value of the second.

Fixes #87526

---------

Co-authored-by: Damyan Pepper <damyanp at microsoft.com>
Co-authored-by: John McCall <rjmccall at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list