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

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

merged 1 commit into from
Dec 2, 2016

Conversation

hughbe
Copy link
Contributor

@hughbe hughbe commented Dec 2, 2016

  • Had to remove using ASTVisitor::visit as MSVC considers it to be ambiguous:
1>C:\Users\hbellamy\Documents\GitHub\my-swift\swift\lib\PrintAsObjC\PrintAsObjC.cpp(162): error C2385: ambiguous access of 'visit'
1>C:\Users\hbellamy\Documents\GitHub\my-swift\swift\lib\PrintAsObjC\PrintAsObjC.cpp(162): note: could be the 'visit' in base 'swift::ASTVisitor<`anonymous namespace'::ObjCPrinter,void,void,void,void,void,void>'
1>C:\Users\hbellamy\Documents\GitHub\my-swift\swift\lib\PrintAsObjC\PrintAsObjC.cpp(162): note: or could be the 'visit' in base 'swift::TypeVisitor<`anonymous namespace'::ObjCPrinter,void,llvm::Optional<enum swift::OptionalTypeKind> >'
  • Fix [[clang::fallthrough]] by replacing it with LLVM_FALLTHROUGH
  • Make ReferencedTypeFinder publically inherit from TypeVisitor due to 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>'

@@ -821,7 +819,7 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
break;
case NullabilityPrintKind::After:
os << ' ';
[[clang::fallthrough]];
LLVM_FALLTHROUGH
Copy link
Contributor

Choose a reason for hiding this comment

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

This should still have a semicolon after it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good spot - its empty on MSVC so never thought of that

@@ -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.

@jrose-apple
Copy link
Contributor

@swift-ci Please smoke test and merge

@swift-ci swift-ci merged commit 42f0527 into swiftlang:master Dec 2, 2016
@hughbe hughbe deleted the printobjc-msvc branch December 2, 2016 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants