Skip to content

Commit ab58b12

Browse files
committed
Apply review feedback
1 parent 86c162c commit ab58b12

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

clang/lib/Sema/SemaSYCL.cpp

+6-10
Original file line numberDiff line numberDiff line change
@@ -3364,17 +3364,17 @@ class SYCLFwdDeclEmitter
33643364
using InnerTypeVisitor = TypeVisitor<SYCLFwdDeclEmitter>;
33653365
using InnerTemplArgVisitor = ConstTemplateArgumentVisitor<SYCLFwdDeclEmitter>;
33663366
raw_ostream &OS;
3367-
llvm::SmallPtrSetImpl<const void *> &Printed;
3367+
llvm::SmallPtrSet<const NamedDecl *, 4> Printed;
33683368
PrintingPolicy Policy;
33693369

3370-
void printForwardDecl(Decl *D) {
3370+
void printForwardDecl(NamedDecl *D) {
33713371
// wrap the declaration into namespaces if needed
33723372
unsigned NamespaceCnt = 0;
33733373
std::string NSStr = "";
33743374
const DeclContext *DC = D->getDeclContext();
33753375

33763376
while (DC) {
3377-
auto *NS = dyn_cast_or_null<NamespaceDecl>(DC);
3377+
const auto *NS = dyn_cast_or_null<NamespaceDecl>(DC);
33783378

33793379
if (!NS)
33803380
break;
@@ -3411,7 +3411,7 @@ class SYCLFwdDeclEmitter
34113411
}
34123412

34133413
// Checks if we've already printed forward declaration and prints it if not.
3414-
void checkAndEmitForwardDecl(Decl *D) {
3414+
void checkAndEmitForwardDecl(NamedDecl *D) {
34153415
if (Printed.insert(D).second)
34163416
printForwardDecl(D);
34173417
}
@@ -3422,10 +3422,7 @@ class SYCLFwdDeclEmitter
34223422
}
34233423

34243424
public:
3425-
SYCLFwdDeclEmitter(raw_ostream &OS,
3426-
llvm::SmallPtrSetImpl<const void *> &Printed,
3427-
LangOptions LO)
3428-
: OS(OS), Printed(Printed), Policy(LO) {
3425+
SYCLFwdDeclEmitter(raw_ostream &OS, LangOptions LO) : OS(OS), Policy(LO) {
34293426
Policy.adjustForCPlusPlusFwdDecl();
34303427
Policy.SuppressTypedefs = true;
34313428
Policy.SuppressUnwrittenScope = true;
@@ -3688,8 +3685,7 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {
36883685
if (!UnnamedLambdaSupport) {
36893686
O << "// Forward declarations of templated kernel function types:\n";
36903687

3691-
llvm::SmallPtrSet<const void *, 4> Printed;
3692-
SYCLFwdDeclEmitter FwdDeclEmitter(O, Printed, S.getLangOpts());
3688+
SYCLFwdDeclEmitter FwdDeclEmitter(O, S.getLangOpts());
36933689
for (const KernelDesc &K : KernelDescs)
36943690
FwdDeclEmitter.Visit(K.NameType);
36953691
}

0 commit comments

Comments
 (0)