Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

[swift-4.0-branch] Add workaround for MSVC bug #42

Closed
wants to merge 1 commit into from
Closed

[swift-4.0-branch] Add workaround for MSVC bug #42

wants to merge 1 commit into from

Conversation

hughbe
Copy link
Collaborator

@hughbe hughbe commented Jan 19, 2017

See #33

The problem is that MSVC doesn't recognise the following syntax, reporting multiple errors here:

  size_t numTrailingObjects(
      typename TrailingObjects::template OverloadToken<SourceLoc>) const {
    return asDerived().hasArgumentLabelLocs()
             ? asDerived().getNumArguments()
             : 0;
  }

For some reason, MSVC ignores the fact that we gave friend access to llvm::TrailingObjects here.

Note that the Swift source code also has to be modified, as this is not enough. This is the new source code, that fully compiles after this change!

  // Work around MSVC bug: can't infer llvm::trailing_objects_internal, even though we granted friend access to it
	size_t numTrailingObjects(
		llvm::trailing_objects_internal::TrailingObjectsBase::OverloadToken<Identifier>) const {
		typename TrailingObjects::template OverloadToken<Identifier>) const {
    return asDerived().getNumArguments();
  }

See swiftlang/swift#3759 (comment)

The problem is that MSVC doesn't recognise the following syntax, reporting multiple errors [here](https://github.com/apple/swift/blob/master/include/swift/AST/Expr.h#L661):
```
  size_t numTrailingObjects(
      typename TrailingObjects::template OverloadToken<SourceLoc>) const {
    return asDerived().hasArgumentLabelLocs()
             ? asDerived().getNumArguments()
             : 0;
  }
```

For some reason, MSVC ignores the fact that we gave friend access to `llvm::TrailingObjects` [here]().

Note that the Swift source code also has to be modified, as this is not enough. This is the new source code, that fully compiles after this change!
```
  // Work around MSVC bug: can't infer llvm::trailing_objects_internal, even though we granted friend access to it
	size_t numTrailingObjects(
		llvm::trailing_objects_internal::TrailingObjectsBase::OverloadToken<Identifier>) const {
		typename TrailingObjects::template OverloadToken<Identifier>) const {
    return asDerived().getNumArguments();
  }
```
@jrose-apple
Copy link
Contributor

Is this already in upstream-with-swift?

@hughbe hughbe changed the title Add workaround for MSVC bug [swift-4.0-branch] Add workaround for MSVC bug Jan 25, 2017
@hughbe
Copy link
Collaborator Author

hughbe commented Feb 24, 2017

Nope: https://reviews.llvm.org/D29880 has been accepted but not yet been merged in.

@jrose-apple
Copy link
Contributor

Let's take the upstream fix instead once you get it merged. (If you don't have commit access there you can ask James to merge it for you.)

@hughbe hughbe closed this Mar 3, 2017
fredriss pushed a commit that referenced this pull request Jul 3, 2018
The variants added are:
    signed Saturating ADD/SUB (immediate)  e.g. sqadd z0.h, z0.h, #42
  unsigned Saturating ADD/SUB (immediate)  e.g. uqadd z0.h, z0.h, #42
    signed Saturating ADD/SUB (vectors)    e.g. sqadd z0.h, z0.h, z1.h
  unsigned Saturating ADD/SUB (vectors)    e.g. uqadd z0.h, z0.h, z1.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336186 91177308-0d34-0410-b5e6-96231b3b80d8
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants