Skip to content

Commit 91b2abe

Browse files
authored
Merge pull request #60531 from apple/pull-request-rebranch
Merge `rebranch` into `main` to support llvm-project `stable/20220421`
2 parents 822174e + 59db203 commit 91b2abe

File tree

122 files changed

+591
-497
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+591
-497
lines changed

include/swift/ABI/Metadata.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,7 @@ struct TargetMetadata {
429429
#endif
430430

431431
#ifndef NDEBUG
432-
LLVM_ATTRIBUTE_DEPRECATED(void dump() const,
433-
"Only meant for use in the debugger");
432+
[[deprecated("Only meant for use in the debugger")]] void dump() const;
434433
#endif
435434

436435
protected:
@@ -2710,8 +2709,7 @@ struct TargetContextDescriptor {
27102709
}
27112710

27122711
#ifndef NDEBUG
2713-
LLVM_ATTRIBUTE_DEPRECATED(void dump() const,
2714-
"only for use in the debugger");
2712+
[[deprecated("Only meant for use in the debugger")]] void dump() const;
27152713
#endif
27162714

27172715
private:
@@ -2976,8 +2974,7 @@ struct TargetProtocolDescriptor final
29762974
}
29772975

29782976
#ifndef NDEBUG
2979-
LLVM_ATTRIBUTE_DEPRECATED(void dump() const,
2980-
"only for use in the debugger");
2977+
[[deprecated("Only meant for use in the debugger")]] void dump() const;
29812978
#endif
29822979

29832980
static bool classof(const TargetContextDescriptor<Runtime> *cd) {
@@ -4449,8 +4446,7 @@ class TargetEnumDescriptor final
44494446
}
44504447

44514448
#ifndef NDEBUG
4452-
LLVM_ATTRIBUTE_DEPRECATED(void dump() const,
4453-
"Only meant for use in the debugger");
4449+
[[deprecated("Only meant for use in the debugger")]] void dump() const;
44544450
#endif
44554451
};
44564452

include/swift/ABI/MetadataValues.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "swift/ABI/KeyPath.h"
2323
#include "swift/ABI/ProtocolDispatchStrategy.h"
2424
#include "swift/AST/Ownership.h"
25+
#include "swift/Basic/Debug.h"
2526
#include "swift/Basic/LLVM.h"
2627
#include "swift/Basic/FlagSet.h"
2728
#include "llvm/ADT/ArrayRef.h"
@@ -531,8 +532,7 @@ class ProtocolDescriptorFlags {
531532
}
532533

533534
#ifndef NDEBUG
534-
LLVM_ATTRIBUTE_DEPRECATED(void dump() const LLVM_ATTRIBUTE_USED,
535-
"Only for use in the debugger");
535+
SWIFT_DEBUG_DUMP;
536536
#endif
537537
};
538538

include/swift/AST/AutoDiff.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ using swift::SILFunctionType;
705705
using swift::DifferentiabilityKind;
706706
using swift::SILDifferentiabilityWitnessKey;
707707

708-
template <typename T> struct DenseMapInfo;
708+
template <typename T, typename Enable> struct DenseMapInfo;
709709

710710
template <> struct DenseMapInfo<AutoDiffConfig> {
711711
static AutoDiffConfig getEmptyKey() {

include/swift/AST/Identifier.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,7 @@ class DeclNameRef {
778778
llvm::raw_ostream &printPretty(llvm::raw_ostream &os) const;
779779

780780
/// Dump this name to standard error.
781-
LLVM_ATTRIBUTE_DEPRECATED(void dump() const LLVM_ATTRIBUTE_USED,
782-
"only for use within the debugger");
781+
SWIFT_DEBUG_DUMP;
783782
};
784783

785784
inline DeclNameRef DeclNameRef::getFromOpaqueValue(void *p) {

include/swift/Basic/Debug.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
/// This deprecates the method so it won't be called directly and marks it as
2121
/// used so it won't be eliminated as dead code.
2222
#define SWIFT_DEBUG_HELPER(method) \
23-
LLVM_ATTRIBUTE_DEPRECATED(method LLVM_ATTRIBUTE_USED, \
24-
"only for use in the debugger")
23+
[[deprecated("only for use in the debugger")]] method LLVM_ATTRIBUTE_USED
2524

2625
/// Declares a const void instance method with the name and parameters provided.
2726
/// Methods declared with this macro should never be called except in the

include/swift/Basic/LangOptions.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -535,15 +535,16 @@ namespace swift {
535535
/// This is only implemented on certain OSs. If no target has been
536536
/// configured, returns v0.0.0.
537537
llvm::VersionTuple getMinPlatformVersion() const {
538-
unsigned major = 0, minor = 0, revision = 0;
539538
if (Target.isMacOSX()) {
540-
Target.getMacOSXVersion(major, minor, revision);
539+
llvm::VersionTuple OSVersion;
540+
Target.getMacOSXVersion(OSVersion);
541+
return OSVersion;
541542
} else if (Target.isiOS()) {
542-
Target.getiOSVersion(major, minor, revision);
543+
return Target.getiOSVersion();
543544
} else if (Target.isWatchOS()) {
544-
Target.getOSVersion(major, minor, revision);
545+
return Target.getOSVersion();
545546
}
546-
return llvm::VersionTuple(major, minor, revision);
547+
return llvm::VersionTuple(/*Major=*/0, /*Minor=*/0, /*Subminor=*/0);
547548
}
548549

549550
/// Sets an implicit platform condition.

include/swift/Basic/Located.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ bool operator ==(const Located<T> &lhs, const Located<T> &rhs) {
5555

5656
namespace llvm {
5757

58-
template <typename T> struct DenseMapInfo;
58+
template <typename T, typename Enable> struct DenseMapInfo;
5959

6060
template<typename T>
6161
struct DenseMapInfo<swift::Located<T>> {

include/swift/Basic/SourceLoc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class CharSourceRange {
248248
} // end namespace swift
249249

250250
namespace llvm {
251-
template <typename T> struct DenseMapInfo;
251+
template <typename T, typename Enable> struct DenseMapInfo;
252252

253253
template <> struct DenseMapInfo<swift::SourceLoc> {
254254
static swift::SourceLoc getEmptyKey() {

include/swift/ClangImporter/SwiftAbstractBasicReader.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ class DataStreamBasicReader
8989
clang::QualType type = asImpl().readTypeRef();
9090
return getASTContext().getQualifiedType(type, quals);
9191
}
92+
93+
const clang::BTFTypeTagAttr *readBTFTypeTagAttr() {
94+
llvm::report_fatal_error("Read BTFTypeTagAttr that should never have been"
95+
" serialized");
96+
}
9297
};
9398

9499
}

include/swift/ClangImporter/SwiftAbstractBasicWriter.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define SWIFT_CLANGIMPORTER_SWIFTABSTRACTBASICWRITER_H
2222

2323
#include "clang/AST/AbstractTypeWriter.h"
24+
#include "clang/AST/Type.h"
2425

2526
namespace swift {
2627

@@ -80,11 +81,24 @@ class DataStreamBasicWriter
8081
assert(!type.isNull());
8182

8283
auto split = type.split();
83-
asImpl().writeQualifiers(split.Quals);
84+
auto qualifiers = split.Quals;
8485

86+
// Unwrap BTFTagAttributeType and merge any of its qualifiers.
87+
while (auto btfType = dyn_cast<clang::BTFTagAttributedType>(split.Ty)) {
88+
split = btfType->getWrappedType().split();
89+
qualifiers.addQualifiers(split.Quals);
90+
}
91+
92+
asImpl().writeQualifiers(qualifiers);
8593
// Just recursively visit the given type.
8694
asImpl().writeTypeRef(split.Ty);
8795
}
96+
97+
void writeBTFTypeTagAttr(const clang::BTFTypeTagAttr *attr) {
98+
// BTFTagAttributeType is explicitly unwrapped above, so we should never
99+
// hit any of its attributes.
100+
llvm::report_fatal_error("Should never hit BTFTypeTagAttr serialization");
101+
}
88102
};
89103

90104
}

0 commit comments

Comments
 (0)