File tree Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Original file line number Diff line number Diff line change 37
37
#include " llvm/ADT/DenseMap.h"
38
38
#include " llvm/ADT/DenseSet.h"
39
39
#include " llvm/Support/TrailingObjects.h"
40
+ #include < type_traits>
40
41
41
42
namespace swift {
42
43
enum class AccessSemantics : unsigned char ;
@@ -6765,6 +6766,9 @@ inline EnumElementDecl *EnumDecl::getUniqueElement(bool hasValue) const {
6765
6766
std::pair<DefaultArgumentKind, Type>
6766
6767
getDefaultArgumentInfo (ValueDecl *source, unsigned Index);
6767
6768
6769
+ // / Display ValueDecl subclasses.
6770
+ void simple_display (llvm::raw_ostream &out, const ValueDecl *&decl);
6771
+
6768
6772
} // end namespace swift
6769
6773
6770
6774
#endif
Original file line number Diff line number Diff line change 25
25
26
26
namespace swift {
27
27
template <typename T>
28
- void simple_display (llvm::raw_ostream &out, const T &value) {
28
+ struct HasTrivialDisplay {
29
+ static const bool value = false ;
30
+ };
31
+
32
+ #define HAS_TRIVIAL_DISPLAY (Type ) \
33
+ template <> \
34
+ struct HasTrivialDisplay <Type> { \
35
+ static const bool value = true ; \
36
+ }
37
+
38
+ HAS_TRIVIAL_DISPLAY (unsigned char );
39
+ HAS_TRIVIAL_DISPLAY (signed char );
40
+ HAS_TRIVIAL_DISPLAY (char );
41
+ HAS_TRIVIAL_DISPLAY (short );
42
+ HAS_TRIVIAL_DISPLAY (unsigned short );
43
+ HAS_TRIVIAL_DISPLAY (int );
44
+ HAS_TRIVIAL_DISPLAY (unsigned int );
45
+ HAS_TRIVIAL_DISPLAY (long );
46
+ HAS_TRIVIAL_DISPLAY (unsigned long );
47
+ HAS_TRIVIAL_DISPLAY (long long );
48
+ HAS_TRIVIAL_DISPLAY (unsigned long long );
49
+ HAS_TRIVIAL_DISPLAY (float );
50
+ HAS_TRIVIAL_DISPLAY (double );
51
+ HAS_TRIVIAL_DISPLAY (bool );
52
+
53
+ #undef HAS_TRIVIAL_DISPLAY
54
+
55
+ template <typename T>
56
+ typename std::enable_if<HasTrivialDisplay<T>::value>::type
57
+ simple_display (llvm::raw_ostream &out, const T &value) {
29
58
out << value;
30
59
}
31
60
Original file line number Diff line number Diff line change @@ -5731,3 +5731,8 @@ NominalTypeDecl *TypeOrExtensionDecl::getBaseNominal() const {
5731
5731
return getAsDeclContext ()->getAsNominalTypeOrNominalTypeExtensionContext ();
5732
5732
}
5733
5733
bool TypeOrExtensionDecl::isNull () const { return Decl.isNull (); }
5734
+
5735
+ void swift::simple_display (llvm::raw_ostream &out, const ValueDecl *&decl) {
5736
+ if (decl) decl->dumpRef (out);
5737
+ else out << " (null)" ;
5738
+ }
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class Outer3
42
42
}
43
43
44
44
// CHECK: ===CYCLE DETECTED===
45
- // CHECK-NEXT: `--{{.*}}SuperclassTypeRequest
45
+ // CHECK-NEXT: `--{{.*}}SuperclassTypeRequest({{.*Left}}
46
46
// CHECK-NEXT: `--{{.*}}InheritedTypeRequest(circular_inheritance.(file).Left@
47
47
// CHECK-NEXT: `--{{.*}}SuperclassTypeRequest
48
48
// CHECK-NEXT: `--{{.*}}InheritedTypeRequest(circular_inheritance.(file).Right@
You can’t perform that action at this time.
0 commit comments