[clang] [HLSL] Implement output parameter (PR #101083)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 29 14:10:17 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff fb7028237bac1dccd328b6c3150e50e222a0879b 874a9d50b63f2ed7220b2e19e8377b545455cd69 --extensions h,cpp -- clang/include/clang/AST/ASTContext.h clang/include/clang/AST/Attr.h clang/include/clang/AST/Expr.h clang/include/clang/AST/RecursiveASTVisitor.h clang/include/clang/AST/TextNodeDumper.h clang/include/clang/Basic/Specifiers.h clang/include/clang/Sema/SemaHLSL.h clang/include/clang/Serialization/ASTBitCodes.h clang/lib/AST/ASTContext.cpp clang/lib/AST/Expr.cpp clang/lib/AST/ExprClassification.cpp clang/lib/AST/ExprConstant.cpp clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/StmtPrinter.cpp clang/lib/AST/StmtProfile.cpp clang/lib/AST/TextNodeDumper.cpp clang/lib/AST/TypePrinter.cpp clang/lib/CodeGen/CGCall.cpp clang/lib/CodeGen/CGCall.h clang/lib/CodeGen/CGExpr.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaExceptionSpec.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaHLSL.cpp clang/lib/Sema/SemaOverload.cpp clang/lib/Sema/SemaSwift.cpp clang/lib/Sema/SemaType.cpp clang/lib/Sema/TreeTransform.h clang/lib/Serialization/ASTReaderStmt.cpp clang/lib/Serialization/ASTWriterStmt.cpp clang/lib/StaticAnalyzer/Core/ExprEngine.cpp clang/tools/libclang/CXCursor.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index 534ffd994c..e81c7170a0 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -1377,7 +1377,6 @@ public:
/// in the return type and parameter types.
bool hasSameFunctionTypeIgnoringPtrSizes(QualType T, QualType U);
-
/// Get or construct a function type that is equivalent to the input type
/// except that the parameter ABI annotations are stripped.
QualType getFunctionTypeWithoutParamABIs(QualType T);
diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index 039719fc1c..83eed4827c 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -7092,8 +7092,7 @@ class HLSLOutArgExpr : public Expr {
public:
static HLSLOutArgExpr *Create(const ASTContext &C, QualType Ty, Expr *Base,
- bool IsInOut, Expr *WB,
- OpaqueValueExpr *OpV);
+ bool IsInOut, Expr *WB, OpaqueValueExpr *OpV);
static HLSLOutArgExpr *CreateEmpty(const ASTContext &Ctx);
const Expr *getBase() const { return Base; }
@@ -7119,11 +7118,10 @@ public:
// Iterators
child_range children() {
- return child_range((Stmt**)&Base, ((Stmt**)&Writeback) + 1);
+ return child_range((Stmt **)&Base, ((Stmt **)&Writeback) + 1);
}
};
-
/// Frontend produces RecoveryExprs on semantic errors that prevent creating
/// other well-formed expressions. E.g. when type-checking of a binary operator
/// fails, we cannot produce a BinaryOperator expression. Instead, we can choose
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 4835c7ab3e..fd1788893b 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -4738,7 +4738,7 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E,
llvm::Value *LifetimeSize = EmitLifetimeStart(Sz, BaseAddr);
- Address TmpAddr (Addr, ElTy, LV.getAlignment());
+ Address TmpAddr(Addr, ElTy, LV.getAlignment());
// TODO-HLSLOutArgExp: Fix me!!!
args.addWriteback(EmitLValue(OE->getBase()->IgnoreImpCasts()), TmpAddr,
nullptr, OE->getWriteback(), LifetimeSize);
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 5c1d996756..2c8c31c8bd 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -1671,7 +1671,7 @@ LValue CodeGenFunction::EmitLValueHelper(const Expr *E,
return EmitCoyieldLValue(cast<CoyieldExpr>(E));
case Expr::PackIndexingExprClass:
return EmitLValue(cast<PackIndexingExpr>(E)->getSelectedExpr());
- case Expr::HLSLOutArgExprClass:
+ case Expr::HLSLOutArgExprClass:
return EmitHLSLOutArgExpr(cast<HLSLOutArgExpr>(E));
}
}
@@ -5411,7 +5411,6 @@ LValue CodeGenFunction::EmitHLSLOutArgExpr(const HLSLOutArgExpr *E) {
return BindHLSLOutArgExpr(E, OutTemp);
}
-
LValue
CodeGenFunction::getOrCreateOpaqueLValueMapping(const OpaqueValueExpr *e) {
assert(OpaqueValueMapping::shouldBindAsLValue(e));
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 9c83c834bc..698b6df90b 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -5919,8 +5919,8 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl,
// During template instantiation it is possible that we already created
// the HLSLOutArgExpr if it was produced during tree transformation.
if ((Proto->getExtParameterInfo(i).getABI() == ParameterABI::HLSLOut ||
- Proto->getExtParameterInfo(i).getABI() == ParameterABI::HLSLInOut) &&
- !isa<HLSLOutArgExpr>(Arg)) {
+ Proto->getExtParameterInfo(i).getABI() == ParameterABI::HLSLInOut) &&
+ !isa<HLSLOutArgExpr>(Arg)) {
ExprResult ArgExpr = HLSL().ActOnOutParamExpr(Param, Arg);
if (ArgExpr.isInvalid())
return true;
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 1ac2fb5634..3118fe577d 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -1176,6 +1176,6 @@ ExprResult SemaHLSL::ActOnOutParamExpr(ParmVarDecl *Param, Expr *Arg) {
}
auto *OpV = new (Ctx)
- OpaqueValueExpr(Param->getBeginLoc(), Ty, VK_LValue, OK_Ordinary, Arg);
+ OpaqueValueExpr(Param->getBeginLoc(), Ty, VK_LValue, OK_Ordinary, Arg);
return ExprResult(HLSLOutArgExpr::Create(Ctx, Ty, Arg, IsInOut, OpV, OpV));
}
diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp
index 4aa9a22ce6..e348ba441f 100644
--- a/clang/lib/Serialization/ASTReaderStmt.cpp
+++ b/clang/lib/Serialization/ASTReaderStmt.cpp
@@ -4304,7 +4304,7 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
break;
}
case EXPR_HLSL_OUT_ARG:
- S = HLSLOutArgExpr::CreateEmpty(Context);
+ S = HLSLOutArgExpr::CreateEmpty(Context);
break;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/101083
More information about the cfe-commits
mailing list