Skip to content

[rebranch] Fix compilation failures #40168

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 10 commits into from
Nov 16, 2021

Conversation

bnbarham
Copy link
Contributor

Haven't run any tests yet, but this at least fixes all the macOS compilation failures.

llvm-project `ErrorHandling.h` was updated to remove std::string. This
added a new `report_fatal_error` overload taking a `const Twine &`,
removed the overload that took `const std::string &`, and updated
`fatal_error_handler_t` to use `const char *` rather than `const
std::string &`.

Fix uses of these functions to take into account these updates. Note
that without the `const std::string &` overload, passing a `std::string`
into `report_fatal_error` now results in an ambiguous match between the
`StringRef` and `Twine` overloads so we need to be explicit about one or
the other.
llvm-project 601102d282d5e9a1429fea52ee17303aec8a7c10 renamed various
functions in `CharInfo.h` and `Lexer.h`. Rename uses in Swift.
llvm-project updated `hashExtension` in
655bea4226b401a11164f99c6344e38d8742b8e4 to use a `HashBuilder` rather
than `hash_code`. Update use in ClangImporter.
@bnbarham
Copy link
Contributor Author

@swift-ci please test

Comment on lines -183 to +185
auto attrs = llvm::AttributeList::get(IGM.getLLVMContext(),
llvm::AttributeList::FunctionIndex,
llvm::Attribute::NoUnwind);

llvm::CallInst *call =
Builder.CreateCall(IGM.getAllocBoxFn(), typeMetadata);
call->setAttributes(attrs);
call->addFnAttr(llvm::Attribute::NoUnwind);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jckarter was this specifically replacing all attributes added in CreateCall or is using add okay (there's a few other cases like this)? The LLVM commits mention possibly hiding AttributeList::AttrIndex in the future so I tried to use the new add(Fn|Param|Ret)* methods where possible. There's just a single FirstArgIndex remaining, used in a replace* method that doesn't have a (Fn|Param|Ret) equivalent at the moment.

If setAttributes is used here on purpose I can just change this to llvm::AttributeList().addFnAttr... instead.

@@ -38,11 +38,11 @@ struct WidthPreservingAPIntDenseMapInfo {
}

static unsigned getHashValue(const APInt &Key) {
return static_cast<unsigned>(hash_value(Key));
return llvm::DenseMapInfo<APInt>::getHashValue(Key);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rjmccall any objections to this change? I'm actually not sure what header is no longer including Hashing.h but this avoids including any extra entirely 🤷

The functions in llvm-project `AttributeList` have been
renamed/refactored to help remove uses of `AttributeList::*Index`.

Update to use these new functions where possible. There's one use of
`AttrIndex` remaining as `replaceAttributeTypeAtIndex` still takes the
index and there is no `param` equivalent. We could add one locally, but
presumably that will be added eventually.
`WidthPreservingAPIntDenseMapInfo` uses the same `getHashValue` and
`isEqual` as the normal `DenseMapInfo` but with different empty and
tombstone keys. `hash_value` is no longer a complete type, so just
delegate to `DenseMapInfo<APInt>` rather than add another `#include`.
`CoverageFilenamesSectionWriter` now takes an `ArrayRef<std::string>`
rather than `ArrayRef<StringRef>`. stable/20210726 reverted that change
so that the coverage formats were the same. stable/20211026 doesn't have
that revert though.
@@ -188,22 +188,22 @@ getAccessorForComputedComponent(IRGenModule &IGM,
case Getter:
// Original accessor's args should be @in or @out, meaning they won't be
// captured or aliased.
accessorThunk->addAttribute(1, llvm::Attribute::NoCapture);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jckarter I'm fairly sure this is correct, but if you want to double check that'd be great :). addParamAttr eventually adds FirstArgIndex, which is 1.

@bnbarham
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 381d053

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 381d053

@bnbarham
Copy link
Contributor Author

swiftlang/llvm-project#3541

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 381d053

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 381d053

@bnbarham
Copy link
Contributor Author

swiftlang/llvm-project#3541

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 381d053

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 381d053

@bnbarham
Copy link
Contributor Author

swiftlang/llvm-project#3541

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 8e99992

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 8e99992

@bnbarham
Copy link
Contributor Author

Going to merge since this is now compiling at least. I can do any fixes to the above later.

@bnbarham bnbarham merged commit 11f2819 into swiftlang:rebranch Nov 16, 2021
@bnbarham bnbarham deleted the rebranch-failures branch November 16, 2021 22:50
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.

2 participants