mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
use new llvm::Optional API
`getValue` -> `value` `getValueOr` -> `value_or` `hasValue` -> `has_value` `map` -> `transform` The old API will be deprecated in the rebranch. To avoid merge conflicts, use the new API already in the main branch. rdar://102362022
This commit is contained in:
@@ -699,9 +699,9 @@ void swift::ide::printModuleInterface(
|
||||
if (!GroupNames.empty()){
|
||||
if (auto TargetGroup = D->getGroupName()) {
|
||||
if (std::find(GroupNames.begin(), GroupNames.end(),
|
||||
TargetGroup.getValue()) != GroupNames.end()) {
|
||||
TargetGroup.value()) != GroupNames.end()) {
|
||||
FileRangedDecls.insert({
|
||||
D->getSourceFileName().getValue(),
|
||||
D->getSourceFileName().value(),
|
||||
std::vector<Decl*>()
|
||||
}).first->getValue().push_back(D);
|
||||
}
|
||||
@@ -718,10 +718,10 @@ void swift::ide::printModuleInterface(
|
||||
auto &DeclsInFile = Entry.getValue();
|
||||
std::sort(DeclsInFile.begin(), DeclsInFile.end(),
|
||||
[](Decl* LHS, Decl *RHS) {
|
||||
assert(LHS->getSourceOrder().hasValue());
|
||||
assert(RHS->getSourceOrder().hasValue());
|
||||
return LHS->getSourceOrder().getValue() <
|
||||
RHS->getSourceOrder().getValue();
|
||||
assert(LHS->getSourceOrder().has_value());
|
||||
assert(RHS->getSourceOrder().has_value());
|
||||
return LHS->getSourceOrder().value() <
|
||||
RHS->getSourceOrder().value();
|
||||
});
|
||||
|
||||
for (auto D : DeclsInFile) {
|
||||
@@ -839,7 +839,7 @@ static SourceLoc getDeclStartPosition(SourceFile &File) {
|
||||
}
|
||||
|
||||
static void printUntilFirstDeclStarts(SourceFile &File, ASTPrinter &Printer) {
|
||||
if (!File.getBufferID().hasValue())
|
||||
if (!File.getBufferID().has_value())
|
||||
return;
|
||||
auto BufferID = *File.getBufferID();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user