Skip to content

Commit

Permalink
Squash; address the non-dumb clang-format complaints.
Browse files Browse the repository at this point in the history
  • Loading branch information
tahonermann committed Jan 10, 2025
1 parent d021c2b commit 20e04ac
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 36 deletions.
5 changes: 2 additions & 3 deletions clang/include/clang/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4720,9 +4720,8 @@ class OutlinedFunctionDecl final

static OutlinedFunctionDecl *Create(ASTContext &C, DeclContext *DC,
unsigned NumParams);
static OutlinedFunctionDecl *CreateDeserialized(ASTContext &C,
GlobalDeclID ID,
unsigned NumParams);
static OutlinedFunctionDecl *
CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumParams);

Stmt *getBody() const override;
void setBody(Stmt *B);
Expand Down
7 changes: 2 additions & 5 deletions clang/include/clang/AST/StmtSYCL.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class SYCLKernelCallStmt : public Stmt {
: Stmt(SYCLKernelCallStmtClass), OriginalStmt(OS), OFDecl(OFD) {}

/// Construct an empty SYCL kernel call statement.
SYCLKernelCallStmt(EmptyShell Empty)
: Stmt(SYCLKernelCallStmtClass, Empty) {}
SYCLKernelCallStmt(EmptyShell Empty) : Stmt(SYCLKernelCallStmtClass, Empty) {}

/// Retrieve the model statement.
Stmt *getOriginalStmt() { return OriginalStmt; }
Expand All @@ -61,9 +60,7 @@ class SYCLKernelCallStmt : public Stmt {
const OutlinedFunctionDecl *getOutlinedFunctionDecl() const { return OFDecl; }

/// Set the outlined function declaration.
void setOutlinedFunctionDecl(OutlinedFunctionDecl *OFD) {
OFDecl = OFD;
}
void setOutlinedFunctionDecl(OutlinedFunctionDecl *OFD) { OFDecl = OFD; }

SourceLocation getBeginLoc() const LLVM_READONLY {
return getOriginalStmt()->getBeginLoc();
Expand Down
26 changes: 15 additions & 11 deletions clang/lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5440,30 +5440,34 @@ BlockDecl *BlockDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) {
return new (C, ID) BlockDecl(nullptr, SourceLocation());
}


OutlinedFunctionDecl::OutlinedFunctionDecl(DeclContext *DC, unsigned NumParams)
: Decl(OutlinedFunction, DC, SourceLocation()), DeclContext(OutlinedFunction),
NumParams(NumParams), BodyAndNothrow(nullptr, false) {}
: Decl(OutlinedFunction, DC, SourceLocation()),
DeclContext(OutlinedFunction), NumParams(NumParams),
BodyAndNothrow(nullptr, false) {}

OutlinedFunctionDecl *OutlinedFunctionDecl::Create(ASTContext &C, DeclContext *DC,
unsigned NumParams) {
OutlinedFunctionDecl *OutlinedFunctionDecl::Create(ASTContext &C,
DeclContext *DC,
unsigned NumParams) {
return new (C, DC, additionalSizeToAlloc<ImplicitParamDecl *>(NumParams))
OutlinedFunctionDecl(DC, NumParams);
}

OutlinedFunctionDecl *OutlinedFunctionDecl::CreateDeserialized(ASTContext &C,
GlobalDeclID ID,
unsigned NumParams) {
OutlinedFunctionDecl *
OutlinedFunctionDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID,
unsigned NumParams) {
return new (C, ID, additionalSizeToAlloc<ImplicitParamDecl *>(NumParams))
OutlinedFunctionDecl(nullptr, NumParams);
}

Stmt *OutlinedFunctionDecl::getBody() const { return BodyAndNothrow.getPointer(); }
Stmt *OutlinedFunctionDecl::getBody() const {
return BodyAndNothrow.getPointer();
}
void OutlinedFunctionDecl::setBody(Stmt *B) { BodyAndNothrow.setPointer(B); }

bool OutlinedFunctionDecl::isNothrow() const { return BodyAndNothrow.getInt(); }
void OutlinedFunctionDecl::setNothrow(bool Nothrow) { BodyAndNothrow.setInt(Nothrow); }

void OutlinedFunctionDecl::setNothrow(bool Nothrow) {
BodyAndNothrow.setInt(Nothrow);
}

CapturedDecl::CapturedDecl(DeclContext *DC, unsigned NumParams)
: Decl(Captured, DC, SourceLocation()), DeclContext(Captured),
Expand Down
23 changes: 10 additions & 13 deletions clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
// This implements Semantic Analysis for SYCL constructs.
//===----------------------------------------------------------------------===//

#include "TreeTransform.h"
#include "clang/Sema/SemaSYCL.h"
#include "TreeTransform.h"
#include "clang/AST/Mangle.h"
#include "clang/AST/StmtSYCL.h"
#include "clang/AST/SYCLKernelInfo.h"
#include "clang/AST/StmtSYCL.h"
#include "clang/AST/TypeOrdering.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Sema/Attr.h"
Expand Down Expand Up @@ -375,16 +375,14 @@ namespace {
class OutlinedFunctionDeclBodyInstantiator
: public TreeTransform<OutlinedFunctionDeclBodyInstantiator> {
public:
using ParmDeclMap = llvm::DenseMap<ParmVarDecl*, VarDecl*>;
using ParmDeclMap = llvm::DenseMap<ParmVarDecl *, VarDecl *>;

OutlinedFunctionDeclBodyInstantiator(Sema &S, ParmDeclMap &M)
: TreeTransform<OutlinedFunctionDeclBodyInstantiator>(S),
SemaRef(S), MapRef(M) {}
: TreeTransform<OutlinedFunctionDeclBodyInstantiator>(S), SemaRef(S),
MapRef(M) {}

// A new set of AST nodes is always required.
bool AlwaysRebuild() {
return true;
}
bool AlwaysRebuild() { return true; }

// Transform ParmVarDecl references to the supplied replacement variables.
ExprResult TransformDeclRefExpr(DeclRefExpr *DRE) {
Expand Down Expand Up @@ -427,7 +425,7 @@ StmtResult SemaSYCL::BuildSYCLKernelCallStmt(FunctionDecl *FD, Stmt *Body) {
// Ensure that the kernel name was previously registered and that the
// stored declaration matches.
const SYCLKernelInfo &SKI =
getASTContext().getSYCLKernelInfo(SKEPAttr->getKernelName());
getASTContext().getSYCLKernelInfo(SKEPAttr->getKernelName());
assert(declaresSameEntity(SKI.getKernelEntryPointDecl(), FD) &&
"SYCL kernel name conflict");

Expand All @@ -439,10 +437,9 @@ StmtResult SemaSYCL::BuildSYCLKernelCallStmt(FunctionDecl *FD, Stmt *Body) {
OutlinedFunctionDecl::Create(getASTContext(), FD, FD->getNumParams());
unsigned i = 0;
for (ParmVarDecl *PVD : FD->parameters()) {
ImplicitParamDecl *IPD =
ImplicitParamDecl::Create(getASTContext(), OFD, SourceLocation(),
PVD->getIdentifier(), PVD->getType(),
ImplicitParamKind::Other);
ImplicitParamDecl *IPD = ImplicitParamDecl::Create(
getASTContext(), OFD, SourceLocation(), PVD->getIdentifier(),
PVD->getType(), ImplicitParamKind::Other);
OFD->setParam(i, IPD);
ParmMap[PVD] = IPD;
++i;
Expand Down
7 changes: 3 additions & 4 deletions clang/lib/Sema/TreeTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -17046,10 +17046,9 @@ QualType TreeTransform<Derived>::RebuildDependentSizedMatrixType(
AttributeLoc);
}

template<typename Derived>
template <typename Derived>
QualType TreeTransform<Derived>::RebuildFunctionProtoType(
QualType T,
MutableArrayRef<QualType> ParamTypes,
QualType T, MutableArrayRef<QualType> ParamTypes,
const FunctionProtoType::ExtProtoInfo &EPI) {
return SemaRef.BuildFunctionType(T, ParamTypes,
getDerived().getBaseLocation(),
Expand Down Expand Up @@ -17405,7 +17404,7 @@ TreeTransform<Derived>::TransformCapturedStmt(CapturedStmt *S) {
return getSema().ActOnCapturedRegionEnd(Body.get());
}

template<typename Derived>
template <typename Derived>
StmtResult
TreeTransform<Derived>::TransformSYCLKernelCallStmt(SYCLKernelCallStmt *S) {
// SYCLKernelCallStmt nodes are inserted upon completion of a (non-template)
Expand Down

0 comments on commit 20e04ac

Please sign in to comment.