Skip to content

Fix errors and warnings building swift/PrintAsObjc on Windows using MSVC #6030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/PrintAsObjC/PrintAsObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,

void print(const Decl *D) {
PrettyStackTraceDecl trace("printing", D);
visit(const_cast<Decl *>(D));
ASTVisitor::visit(const_cast<Decl *>(D));
}

void printAdHocCategory(iterator_range<const ValueDecl * const *> members) {
Expand Down Expand Up @@ -194,8 +194,6 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
}

private:
using ASTVisitor::visit;

/// Prints a protocol adoption list: <code>&lt;NSCoding, NSCopying&gt;</code>
///
/// This method filters out non-ObjC protocols, along with the special
Expand Down Expand Up @@ -241,7 +239,7 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
protocolMembersOptional = VD->getAttrs().hasAttribute<OptionalAttr>();
os << (protocolMembersOptional ? "@optional\n" : "@required\n");
}
visit(const_cast<ValueDecl*>(VD));
ASTVisitor::visit(const_cast<ValueDecl*>(VD));
}
}

Expand Down Expand Up @@ -821,7 +819,7 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
break;
case NullabilityPrintKind::After:
os << ' ';
[[clang::fallthrough]];
LLVM_FALLTHROUGH;
case NullabilityPrintKind::Before:
switch (*kind) {
case OTK_None:
Expand Down Expand Up @@ -1536,7 +1534,7 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
}
};

class ReferencedTypeFinder : private TypeVisitor<ReferencedTypeFinder> {
class ReferencedTypeFinder : public TypeVisitor<ReferencedTypeFinder> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to be public?

Copy link
Contributor Author

@hughbe hughbe Dec 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We get the following error:

1>C:\Users\hbellamy\Documents\GitHub\my-swift\swift\lib\PrintAsObjC\PrintAsObjC.cpp(1907): error C2247: 'swift::TypeVisitor<`anonymous-namespace'::ReferencedTypeFinder,void>::visit' not accessible because '`anonymous-namespace'::ReferencedTypeFinder' uses 'private' to inherit from 'swift::TypeVisitor<`anonymous-namespace'::ReferencedTypeFinder,void>'
1>  C:\Users\hbellamy\Documents\GitHub\my-swift\swift\include\swift/AST/TypeVisitor.h(30): note: see declaration of 'swift::TypeVisitor<`anonymous-namespace'::ReferencedTypeFinder,void>::visit'
1>  C:\Users\hbellamy\Documents\GitHub\my-swift\swift\lib\PrintAsObjC\PrintAsObjC.cpp(1539): note: see declaration of '`anonymous-namespace'::ReferencedTypeFinder'
1>  C:\Users\hbellamy\Documents\GitHub\my-swift\swift\lib\PrintAsObjC\PrintAsObjC.cpp(1539): note: see declaration of 'swift::TypeVisitor<`anonymous-namespace'::ReferencedTypeFinder,void>'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to say "why not just redeclare the visit method" but I guess it doesn't matter; these are all local helper types anyway.

friend TypeVisitor;

ModuleDecl &M;
Expand Down Expand Up @@ -1782,6 +1780,8 @@ class ModuleWriter {
case EmissionState::Defined:
return true;
}

llvm_unreachable("Unhandled EmissionState in switch.");
}

void forwardDeclare(const NominalTypeDecl *NTD,
Expand Down