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 origin/main HEAD --extensions cpp,h --
clang/include/clang/AST/Reflection.h
clang/test/Parser/reflection-meta-info.fail.cpp
clang/test/Parser/reflection-meta-info.pass.cpp
clang/include/clang/AST/APValue.h clang/include/clang/AST/ASTContext.h
clang/include/clang/AST/ExprCXX.h clang/include/clang/AST/TypeBase.h
clang/include/clang/Basic/TargetInfo.h clang/lib/AST/APValue.cpp
clang/lib/AST/ASTContext.cpp clang/lib/AST/ExprCXX.cpp
clang/lib/AST/ExprConstant.cpp clang/lib/AST/Type.cpp
clang/lib/Basic/TargetInfo.cpp clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenTypes.cpp clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaOverload.cpp
clang/lib/Sema/TreeTransform.h
clang/test/CodeGenCXX/reflection-mangle-itanium.cpp
clang/test/CodeGenCXX/reflection-mangle-ms.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/AST/APValue.h
b/clang/include/clang/AST/APValue.h
index 2492dd484..cec4028f5 100644
--- a/clang/include/clang/AST/APValue.h
+++ b/clang/include/clang/AST/APValue.h
@@ -323,9 +323,10 @@ private:
struct MemberPointerData;
// We ensure elsewhere that Data is big enough for LV and MemberPointerData.
- typedef llvm::AlignedCharArrayUnion<void *, APSInt, APFloat, ComplexAPSInt,
- ComplexAPFloat, Vec, Mat, Arr,
StructData,
- UnionData, AddrLabelDiffData,
ReflectionData> DataType;
+ typedef llvm::AlignedCharArrayUnion<
+ void *, APSInt, APFloat, ComplexAPSInt, ComplexAPFloat, Vec, Mat, Arr,
+ StructData, UnionData, AddrLabelDiffData, ReflectionData>
+ DataType;
static const size_t DataSize = sizeof(DataType);
DataType Data;
@@ -423,8 +424,7 @@ public:
/// Creates a new Reflection APValue.
/// \param OperandKind The kind of reflection.
/// \param Operand The entity being reflected.
- APValue(ReflectionKind OperandKind, const void *Operand)
- : Kind(None) {
+ APValue(ReflectionKind OperandKind, const void *Operand) : Kind(None) {
MakeReflection(OperandKind, Operand);
}
@@ -721,7 +721,7 @@ public:
return ((const ReflectionData *)(const char *)&Data)->OperandKind;
}
- const void* getOpaqueReflectionOperand() const {
+ const void *getOpaqueReflectionOperand() const {
assert(isReflection() && "Invalid accessor");
return ((const ReflectionData *)(const char *)&Data)->Operand;
}
@@ -776,11 +776,9 @@ public:
private:
void DestroyDataAndMakeUninit();
- void MakeReflection(ReflectionKind OperandKind,
- const void *Operand) {
+ void MakeReflection(ReflectionKind OperandKind, const void *Operand) {
assert(isAbsent() && "Bad state change");
- new ((void *)(char *)Data.buffer) ReflectionData(
- OperandKind, Operand);
+ new ((void *)(char *)Data.buffer) ReflectionData(OperandKind, Operand);
Kind = Reflection;
}
void MakeInt() {
diff --git a/clang/include/clang/AST/ExprCXX.h
b/clang/include/clang/AST/ExprCXX.h
index 824d96cb9..9a38ccc3c 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -5509,18 +5509,18 @@ public:
/// - an id-expression.
class CXXReflectExpr : public Expr {
+private:
+ // TODO(Reflection): add support for TemplateReference, NamespaceReference
and
+ // DeclRefExpr
+ using operand_type = llvm::PointerUnion<const TypeSourceInfo *>;
- private:
- // TODO(Reflection): add support for TemplateReference, NamespaceReference
and
- // DeclRefExpr
- using operand_type = llvm::PointerUnion<const TypeSourceInfo *>;
-
- SourceLocation CaretCaretLoc;
- ReflectionKind Kind;
- operand_type Operand;
+ SourceLocation CaretCaretLoc;
+ ReflectionKind Kind;
+ operand_type Operand;
- CXXReflectExpr(ASTContext &C, SourceLocation CaretCaretLoc, const
TypeSourceInfo *TSI);
- CXXReflectExpr(EmptyShell Empty);
+ CXXReflectExpr(ASTContext &C, SourceLocation CaretCaretLoc,
+ const TypeSourceInfo *TSI);
+ CXXReflectExpr(EmptyShell Empty);
public:
static CXXReflectExpr *Create(ASTContext &C, SourceLocation OperatorLoc,
@@ -5543,7 +5543,7 @@ public:
/// Returns location of the '^^'-operator.
SourceLocation getOperatorLoc() const { return CaretCaretLoc; }
ReflectionKind getKind() const { return Kind; }
- const void* getOpaqueValue() const { return Operand.getOpaqueValue(); }
+ const void *getOpaqueValue() const { return Operand.getOpaqueValue(); }
child_range children() {
// TODO(Reflection)
diff --git a/clang/include/clang/AST/Reflection.h
b/clang/include/clang/AST/Reflection.h
index 140f48af6..c50c20a0c 100644
--- a/clang/include/clang/AST/Reflection.h
+++ b/clang/include/clang/AST/Reflection.h
@@ -10,16 +10,13 @@
//
//===----------------------------------------------------------------------===//
-
#ifndef LLVM_CLANG_AST_REFLECTION_H
#define LLVM_CLANG_AST_REFLECTION_H
namespace clang {
// TODO(Reflection): Add support for Template, Namespace and DeclRefExpr.
-enum class ReflectionKind {
- Type
-};
+enum class ReflectionKind { Type };
-}
+} // namespace clang
#endif
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index 32faed3bc..d36048100 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -383,7 +383,8 @@ APValue::APValue(const APValue &RHS)
setAddrLabelDiff(RHS.getAddrLabelDiffLHS(), RHS.getAddrLabelDiffRHS());
break;
case Reflection:
- MakeReflection(RHS.getReflectionOperandKind(),
RHS.getOpaqueReflectionOperand());
+ MakeReflection(RHS.getReflectionOperandKind(),
+ RHS.getOpaqueReflectionOperand());
break;
}
}
@@ -503,11 +504,12 @@ static void profileIntValue(llvm::FoldingSetNodeID &ID,
const llvm::APInt &V) {
static void profileReflection(llvm::FoldingSetNodeID &ID, APValue V) {
ID.AddInteger(static_cast<int>(V.getReflectionOperandKind()));
switch (V.getReflectionOperandKind()) {
- case ReflectionKind::Type: {
- const TypeSourceInfo* info = static_cast<const
TypeSourceInfo*>(V.getOpaqueReflectionOperand());
- ID.AddPointer((info->getType().getCanonicalType().getAsOpaquePtr()));
- return;
- }
+ case ReflectionKind::Type: {
+ const TypeSourceInfo *info =
+ static_cast<const TypeSourceInfo *>(V.getOpaqueReflectionOperand());
+ ID.AddPointer((info->getType().getCanonicalType().getAsOpaquePtr()));
+ return;
+ }
assert(false && "unknown or unimplemented reflection entities");
}
}
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 827710c01..6c771ad00 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -48,10 +48,10 @@
#include "clang/AST/OSLog.h"
#include "clang/AST/OptionalDiagnostic.h"
#include "clang/AST/RecordLayout.h"
+#include "clang/AST/Reflection.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
-#include "clang/AST/Reflection.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Basic/TargetBuiltins.h"
@@ -2474,7 +2474,7 @@ static bool
CheckEvaluationResult(CheckEvaluationResultKind CERK,
}
if (Value.isStruct()) {
if (Type->isMetaInfoType())
- return true;
+ return true;
auto *RD = Type->castAsRecordDecl();
if (const CXXRecordDecl *CD = dyn_cast<CXXRecordDecl>(RD)) {
unsigned BaseIndex = 0;
@@ -10945,15 +10945,15 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const
CXXNewExpr *E) {
//===----------------------------------------------------------------------===//
namespace {
-class ReflectionEvaluator
- : public ExprEvaluatorBase<ReflectionEvaluator> {
+class ReflectionEvaluator : public ExprEvaluatorBase<ReflectionEvaluator> {
using BaseType = ExprEvaluatorBase<ReflectionEvaluator>;
APValue &Result;
+
public:
ReflectionEvaluator(EvalInfo &E, APValue &Result)
- : ExprEvaluatorBaseTy(E), Result(Result) {}
+ : ExprEvaluatorBaseTy(E), Result(Result) {}
bool Success(const APValue &V, const Expr *E) {
Result = V;
@@ -10965,14 +10965,14 @@ public:
bool ReflectionEvaluator::VisitCXXReflectExpr(const CXXReflectExpr *E) {
switch (E->getKind()) {
- case ReflectionKind::Type: {
- APValue Result(ReflectionKind::Type, E->getOpaqueValue());
- return Success(Result, E);
- }
+ case ReflectionKind::Type: {
+ APValue Result(ReflectionKind::Type, E->getOpaqueValue());
+ return Success(Result, E);
+ }
}
llvm_unreachable("invalid reflection");
}
-} // end anonymous namespace
+} // end anonymous namespace
static bool EvaluateReflection(const Expr *E, APValue &Result, EvalInfo &Info)
{
assert(E->isPRValue() && E->getType()->isMetaInfoType());
@@ -20740,7 +20740,7 @@ static bool Evaluate(APValue &Result, EvalInfo &Info,
const Expr *E) {
if (!IntExprEvaluator(Info, Result).Visit(E))
return false;
} else if (T->isMetaInfoType()) {
- if(!EvaluateReflection(E, Result, Info))
+ if (!EvaluateReflection(E, Result, Info))
return false;
} else if (T->hasPointerRepresentation()) {
LValue LV;
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index e93397d14..59b61e137 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -3119,7 +3119,7 @@ bool Type::isLiteralType(const ASTContext &Ctx) const {
// -- std::meta::info is a scalar type
// C++26 [basic.types]p10:
// -- a scalar type is a literal type
- if(isMetaInfoType())
+ if (isMetaInfoType())
return true;
// We treat _Atomic T as a literal type if T is a literal type.
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e1c86e56b..8d8ec15f3 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -12946,8 +12946,8 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS,
ExprResult &RHS,
*CCT, Loc, ComparisonCategoryUsage::OperatorInExpression);
};
- if(LHSType->isMetaInfoType() && RHSType->isMetaInfoType()){
- if(!BinaryOperator::isEqualityOp(Opc)) {
+ if (LHSType->isMetaInfoType() && RHSType->isMetaInfoType()) {
+ if (!BinaryOperator::isEqualityOp(Opc)) {
return InvalidOperands(Loc, LHS, RHS);
}
return computeResultTy();
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 94a58870f..48672478e 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -9094,12 +9094,9 @@ public:
typedef TypeSet::iterator iterator;
BuiltinCandidateTypeSet(Sema &SemaRef)
- : HasNonRecordTypes(false),
- HasArithmeticOrEnumeralTypes(false),
- HasNullPtrType(false),
- HasReflectionType(false),
- SemaRef(SemaRef),
- Context(SemaRef.Context) { }
+ : HasNonRecordTypes(false), HasArithmeticOrEnumeralTypes(false),
+ HasNullPtrType(false), HasReflectionType(false), SemaRef(SemaRef),
+ Context(SemaRef.Context) {}
void AddTypesConvertedFrom(QualType Ty,
SourceLocation Loc,
@@ -9789,7 +9786,7 @@ public:
if (CandidateTypes[ArgIdx].hasReflectionType()) {
CanQualType InfoTy = S.Context.getCanonicalType(S.Context.MetaInfoTy);
if (AddedTypes.insert(InfoTy).second) {
- QualType ParamTypes[2] = { InfoTy, InfoTy };
+ QualType ParamTypes[2] = {InfoTy, InfoTy};
S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/190356
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits